Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(33)

Side by Side Diff: chrome/browser/extensions/extension_notification_observer.cc

Issue 298883006: Rename NOTIFICATION_EXTENSION_INSTALLED to (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add comment Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/extensions/extension_notification_observer.h" 5 #include "chrome/browser/extensions/extension_notification_observer.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 18 matching lines...) Expand all
29 } 29 }
30 30
31 } // namespace 31 } // namespace
32 32
33 ExtensionNotificationObserver::ExtensionNotificationObserver( 33 ExtensionNotificationObserver::ExtensionNotificationObserver(
34 content::NotificationSource source, 34 content::NotificationSource source,
35 const std::set<std::string>& extension_ids) 35 const std::set<std::string>& extension_ids)
36 : extension_ids_(extension_ids) { 36 : extension_ids_(extension_ids) {
37 registrar_.Add( 37 registrar_.Add(
38 this, chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, source); 38 this, chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, source);
39 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_INSTALLED, source); 39 registrar_.Add(
40 this, chrome::NOTIFICATION_EXTENSION_INSTALLED_DEPRECATED, source);
40 registrar_.Add( 41 registrar_.Add(
41 this, chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, source); 42 this, chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, source);
42 } 43 }
43 44
44 ExtensionNotificationObserver::~ExtensionNotificationObserver() {} 45 ExtensionNotificationObserver::~ExtensionNotificationObserver() {}
45 46
46 testing::AssertionResult ExtensionNotificationObserver::CheckNotifications() { 47 testing::AssertionResult ExtensionNotificationObserver::CheckNotifications() {
47 return CheckNotifications(std::vector<chrome::NotificationType>()); 48 return CheckNotifications(std::vector<chrome::NotificationType>());
48 } 49 }
49 50
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 types.push_back(t6); 89 types.push_back(t6);
89 return CheckNotifications(types); 90 return CheckNotifications(types);
90 } 91 }
91 92
92 // content::NotificationObserver implementation. 93 // content::NotificationObserver implementation.
93 void ExtensionNotificationObserver::Observe( 94 void ExtensionNotificationObserver::Observe(
94 int type, 95 int type,
95 const content::NotificationSource& source, 96 const content::NotificationSource& source,
96 const content::NotificationDetails& details) { 97 const content::NotificationDetails& details) {
97 switch (type) { 98 switch (type) {
98 case chrome::NOTIFICATION_EXTENSION_INSTALLED: { 99 case chrome::NOTIFICATION_EXTENSION_INSTALLED_DEPRECATED: {
99 const Extension* extension = 100 const Extension* extension =
100 content::Details<const InstalledExtensionInfo>(details)->extension; 101 content::Details<const InstalledExtensionInfo>(details)->extension;
101 if (extension_ids_.count(extension->id())) 102 if (extension_ids_.count(extension->id()))
102 notifications_.push_back(static_cast<chrome::NotificationType>(type)); 103 notifications_.push_back(static_cast<chrome::NotificationType>(type));
103 break; 104 break;
104 } 105 }
105 106
106 case chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED: { 107 case chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED: {
107 const Extension* extension = 108 const Extension* extension =
108 content::Details<const Extension>(details).ptr(); 109 content::Details<const Extension>(details).ptr();
(...skipping 25 matching lines...) Expand all
134 const std::vector<chrome::NotificationType>& types) { 135 const std::vector<chrome::NotificationType>& types) {
135 testing::AssertionResult result = (notifications_ == types) ? 136 testing::AssertionResult result = (notifications_ == types) ?
136 testing::AssertionSuccess() : 137 testing::AssertionSuccess() :
137 testing::AssertionFailure() << "Expected " << Str(types) << ", " << 138 testing::AssertionFailure() << "Expected " << Str(types) << ", " <<
138 "Got " << Str(notifications_); 139 "Got " << Str(notifications_);
139 notifications_.clear(); 140 notifications_.clear();
140 return result; 141 return result;
141 } 142 }
142 143
143 } // namespace extensions 144 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/error_console/error_console.cc ('k') | chrome/browser/extensions/extension_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698