LCOV - code coverage report
Current view: directory - ipc/chromium/src/chrome/common - notification_details.h (source / functions) Found Hit Coverage
Test: app.info Lines: 4 0 0.0 %
Date: 2012-06-02 Functions: 4 0 0.0 %

       1                 : // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
       2                 : // Use of this source code is governed by a BSD-style license that can be
       3                 : // found in the LICENSE file.
       4                 : 
       5                 : // This file defines the type used to provide details for NotificationService
       6                 : // notifications.
       7                 : 
       8                 : #ifndef CHROME_COMMON_NOTIFICATION_DETAILS_H__
       9                 : #define CHROME_COMMON_NOTIFICATION_DETAILS_H__
      10                 : 
      11                 : #include "base/basictypes.h"
      12                 : 
      13                 : // Do not declare a NotificationDetails directly--use either
      14                 : // "Details<detailsclassname>(detailsclasspointer)" or
      15                 : // NotificationService::NoDetails().
      16                 : class NotificationDetails {
      17                 :  public:
      18                 :   NotificationDetails() : ptr_(NULL) {}
      19                 :   NotificationDetails(const NotificationDetails& other) : ptr_(other.ptr_) {}
      20               0 :   ~NotificationDetails() {}
      21                 : 
      22                 :   // NotificationDetails can be used as the index for a map; this method
      23                 :   // returns the pointer to the current details as an identifier, for use as a
      24                 :   // map index.
      25                 :   uintptr_t map_key() const { return reinterpret_cast<uintptr_t>(ptr_); }
      26                 : 
      27                 :   bool operator!=(const NotificationDetails& other) const {
      28                 :     return ptr_ != other.ptr_;
      29                 :   }
      30                 : 
      31                 :   bool operator==(const NotificationDetails& other) const {
      32                 :     return ptr_ == other.ptr_;
      33                 :   }
      34                 : 
      35                 :  protected:
      36               0 :   NotificationDetails(void* ptr) : ptr_(ptr) {}
      37                 : 
      38                 :   void* ptr_;
      39                 : };
      40                 : 
      41                 : template <class T>
      42               0 : class Details : public NotificationDetails {
      43                 :  public:
      44               0 :   Details(T* ptr) : NotificationDetails(ptr) {}
      45                 :   Details(const NotificationDetails& other)
      46                 :     : NotificationDetails(other) {}
      47                 : 
      48                 :   T* operator->() const { return ptr(); }
      49                 :   T* ptr() const { return static_cast<T*>(ptr_); }
      50                 : };
      51                 : 
      52                 : #endif  // CHROME_COMMON_NOTIFICATION_DETAILS_H__

Generated by: LCOV version 1.7