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

Side by Side Diff: chrome/browser/extensions/api/runtime/chrome_runtime_api_delegate.cc

Issue 425303002: Move extension notifications to extensions/browser/notification_types.h (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: (extension-notifications) rebase Created 6 years, 4 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/api/runtime/chrome_runtime_api_delegate.h" 5 #include "chrome/browser/extensions/api/runtime/chrome_runtime_api_delegate.h"
6 6
7 #include "base/message_loop/message_loop.h" 7 #include "base/message_loop/message_loop.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/time/time.h" 9 #include "base/time/time.h"
10 #include "chrome/browser/chrome_notification_types.h"
11 #include "chrome/browser/extensions/extension_service.h" 10 #include "chrome/browser/extensions/extension_service.h"
12 #include "chrome/browser/extensions/extension_warning_service.h" 11 #include "chrome/browser/extensions/extension_warning_service.h"
13 #include "chrome/browser/extensions/extension_warning_set.h" 12 #include "chrome/browser/extensions/extension_warning_set.h"
14 #include "chrome/browser/extensions/updater/extension_updater.h" 13 #include "chrome/browser/extensions/updater/extension_updater.h"
15 #include "chrome/browser/profiles/profile.h" 14 #include "chrome/browser/profiles/profile.h"
16 #include "chrome/browser/ui/browser_finder.h" 15 #include "chrome/browser/ui/browser_finder.h"
17 #include "chrome/browser/ui/browser_navigator.h" 16 #include "chrome/browser/ui/browser_navigator.h"
18 #include "chrome/browser/ui/browser_window.h" 17 #include "chrome/browser/ui/browser_window.h"
19 #include "components/omaha_query_params/omaha_query_params.h" 18 #include "components/omaha_query_params/omaha_query_params.h"
20 #include "content/public/browser/notification_service.h" 19 #include "content/public/browser/notification_service.h"
21 #include "extensions/browser/extension_system.h" 20 #include "extensions/browser/extension_system.h"
21 #include "extensions/browser/notification_types.h"
22 #include "extensions/common/api/runtime.h" 22 #include "extensions/common/api/runtime.h"
23 23
24 #if defined(OS_CHROMEOS) 24 #if defined(OS_CHROMEOS)
25 #include "chrome/browser/chromeos/login/users/user_manager.h" 25 #include "chrome/browser/chromeos/login/users/user_manager.h"
26 #include "chromeos/dbus/dbus_thread_manager.h" 26 #include "chromeos/dbus/dbus_thread_manager.h"
27 #include "chromeos/dbus/power_manager_client.h" 27 #include "chromeos/dbus/power_manager_client.h"
28 #endif 28 #endif
29 29
30 using extensions::Extension; 30 using extensions::Extension;
31 using extensions::ExtensionSystem; 31 using extensions::ExtensionSystem;
(...skipping 14 matching lines...) Expand all
46 // After this many suspiciously fast consecutive reloads, an extension will get 46 // After this many suspiciously fast consecutive reloads, an extension will get
47 // disabled. 47 // disabled.
48 const int kFastReloadCount = 5; 48 const int kFastReloadCount = 5;
49 49
50 } // namespace 50 } // namespace
51 51
52 ChromeRuntimeAPIDelegate::ChromeRuntimeAPIDelegate( 52 ChromeRuntimeAPIDelegate::ChromeRuntimeAPIDelegate(
53 content::BrowserContext* context) 53 content::BrowserContext* context)
54 : browser_context_(context), registered_for_updates_(false) { 54 : browser_context_(context), registered_for_updates_(false) {
55 registrar_.Add(this, 55 registrar_.Add(this,
56 chrome::NOTIFICATION_EXTENSION_UPDATE_FOUND, 56 extensions::NOTIFICATION_EXTENSION_UPDATE_FOUND,
57 content::NotificationService::AllSources()); 57 content::NotificationService::AllSources());
58 } 58 }
59 59
60 ChromeRuntimeAPIDelegate::~ChromeRuntimeAPIDelegate() { 60 ChromeRuntimeAPIDelegate::~ChromeRuntimeAPIDelegate() {
61 } 61 }
62 62
63 void ChromeRuntimeAPIDelegate::AddUpdateObserver( 63 void ChromeRuntimeAPIDelegate::AddUpdateObserver(
64 extensions::UpdateObserver* observer) { 64 extensions::UpdateObserver* observer) {
65 registered_for_updates_ = true; 65 registered_for_updates_ = true;
66 ExtensionSystem::Get(browser_context_) 66 ExtensionSystem::Get(browser_context_)
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 } 238 }
239 #endif 239 #endif
240 *error_message = "Function available only for ChromeOS kiosk mode."; 240 *error_message = "Function available only for ChromeOS kiosk mode.";
241 return false; 241 return false;
242 } 242 }
243 243
244 void ChromeRuntimeAPIDelegate::Observe( 244 void ChromeRuntimeAPIDelegate::Observe(
245 int type, 245 int type,
246 const content::NotificationSource& source, 246 const content::NotificationSource& source,
247 const content::NotificationDetails& details) { 247 const content::NotificationDetails& details) {
248 DCHECK(type == chrome::NOTIFICATION_EXTENSION_UPDATE_FOUND); 248 DCHECK(type == extensions::NOTIFICATION_EXTENSION_UPDATE_FOUND);
249 typedef const std::pair<std::string, Version> UpdateDetails; 249 typedef const std::pair<std::string, Version> UpdateDetails;
250 const std::string& id = content::Details<UpdateDetails>(details)->first; 250 const std::string& id = content::Details<UpdateDetails>(details)->first;
251 const Version& version = content::Details<UpdateDetails>(details)->second; 251 const Version& version = content::Details<UpdateDetails>(details)->second;
252 if (version.IsValid()) { 252 if (version.IsValid()) {
253 CallUpdateCallbacks( 253 CallUpdateCallbacks(
254 id, UpdateCheckResult(true, kUpdateFound, version.GetString())); 254 id, UpdateCheckResult(true, kUpdateFound, version.GetString()));
255 } 255 }
256 } 256 }
257 257
258 void ChromeRuntimeAPIDelegate::UpdateCheckComplete( 258 void ChromeRuntimeAPIDelegate::UpdateCheckComplete(
(...skipping 16 matching lines...) Expand all
275 const UpdateCheckResult& result) { 275 const UpdateCheckResult& result) {
276 UpdateCallbackList callbacks = pending_update_checks_[extension_id]; 276 UpdateCallbackList callbacks = pending_update_checks_[extension_id];
277 pending_update_checks_.erase(extension_id); 277 pending_update_checks_.erase(extension_id);
278 for (UpdateCallbackList::const_iterator iter = callbacks.begin(); 278 for (UpdateCallbackList::const_iterator iter = callbacks.begin();
279 iter != callbacks.end(); 279 iter != callbacks.end();
280 ++iter) { 280 ++iter) {
281 const UpdateCheckCallback& callback = *iter; 281 const UpdateCheckCallback& callback = *iter;
282 callback.Run(result); 282 callback.Run(result);
283 } 283 }
284 } 284 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698