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

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

Issue 503033002: Move ExtensionWarningService and ExtensionsWarningSet to extensions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@3_web_view_internal
Patch Set: Rename. Created 6 years, 3 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 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/extensions/extension_service.h" 10 #include "chrome/browser/extensions/extension_service.h"
11 #include "chrome/browser/extensions/extension_warning_service.h"
12 #include "chrome/browser/extensions/extension_warning_set.h"
13 #include "chrome/browser/extensions/updater/extension_updater.h" 11 #include "chrome/browser/extensions/updater/extension_updater.h"
14 #include "chrome/browser/profiles/profile.h" 12 #include "chrome/browser/profiles/profile.h"
15 #include "chrome/browser/ui/browser_finder.h" 13 #include "chrome/browser/ui/browser_finder.h"
16 #include "chrome/browser/ui/browser_navigator.h" 14 #include "chrome/browser/ui/browser_navigator.h"
17 #include "chrome/browser/ui/browser_window.h" 15 #include "chrome/browser/ui/browser_window.h"
18 #include "components/omaha_query_params/omaha_query_params.h" 16 #include "components/omaha_query_params/omaha_query_params.h"
19 #include "content/public/browser/notification_service.h" 17 #include "content/public/browser/notification_service.h"
20 #include "extensions/browser/extension_system.h" 18 #include "extensions/browser/extension_system.h"
21 #include "extensions/browser/notification_types.h" 19 #include "extensions/browser/notification_types.h"
20 #include "extensions/browser/warning_service.h"
21 #include "extensions/browser/warning_set.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 "chromeos/dbus/dbus_thread_manager.h" 25 #include "chromeos/dbus/dbus_thread_manager.h"
26 #include "chromeos/dbus/power_manager_client.h" 26 #include "chromeos/dbus/power_manager_client.h"
27 #include "components/user_manager/user_manager.h" 27 #include "components/user_manager/user_manager.h"
28 #endif 28 #endif
29 29
30 using extensions::Extension; 30 using extensions::Extension;
31 using extensions::ExtensionSystem; 31 using extensions::ExtensionSystem;
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 // Unloading an extension clears all warnings, so first terminate the 113 // Unloading an extension clears all warnings, so first terminate the
114 // extension, and then add the warning. Since this is called from an 114 // extension, and then add the warning. Since this is called from an
115 // extension function unloading the extension has to be done 115 // extension function unloading the extension has to be done
116 // asynchronously. Fortunately PostTask guarentees FIFO order so just 116 // asynchronously. Fortunately PostTask guarentees FIFO order so just
117 // post both tasks. 117 // post both tasks.
118 base::MessageLoop::current()->PostTask( 118 base::MessageLoop::current()->PostTask(
119 FROM_HERE, 119 FROM_HERE,
120 base::Bind(&ExtensionService::TerminateExtension, 120 base::Bind(&ExtensionService::TerminateExtension,
121 service->AsWeakPtr(), 121 service->AsWeakPtr(),
122 extension_id)); 122 extension_id));
123 extensions::ExtensionWarningSet warnings; 123 extensions::WarningSet warnings;
124 warnings.insert( 124 warnings.insert(
125 extensions::ExtensionWarning::CreateReloadTooFrequentWarning( 125 extensions::Warning::CreateReloadTooFrequentWarning(
126 extension_id)); 126 extension_id));
127 base::MessageLoop::current()->PostTask( 127 base::MessageLoop::current()->PostTask(
128 FROM_HERE, 128 FROM_HERE,
129 base::Bind(&extensions::ExtensionWarningService::NotifyWarningsOnUI, 129 base::Bind(&extensions::WarningService::NotifyWarningsOnUI,
130 browser_context_, 130 browser_context_,
131 warnings)); 131 warnings));
132 } else { 132 } else {
133 // We can't call ReloadExtension directly, since when this method finishes 133 // We can't call ReloadExtension directly, since when this method finishes
134 // it tries to decrease the reference count for the extension, which fails 134 // it tries to decrease the reference count for the extension, which fails
135 // if the extension has already been reloaded; so instead we post a task. 135 // if the extension has already been reloaded; so instead we post a task.
136 base::MessageLoop::current()->PostTask( 136 base::MessageLoop::current()->PostTask(
137 FROM_HERE, 137 FROM_HERE,
138 base::Bind(&ExtensionService::ReloadExtension, 138 base::Bind(&ExtensionService::ReloadExtension,
139 service->AsWeakPtr(), 139 service->AsWeakPtr(),
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 const UpdateCheckResult& result) { 271 const UpdateCheckResult& result) {
272 UpdateCallbackList callbacks = pending_update_checks_[extension_id]; 272 UpdateCallbackList callbacks = pending_update_checks_[extension_id];
273 pending_update_checks_.erase(extension_id); 273 pending_update_checks_.erase(extension_id);
274 for (UpdateCallbackList::const_iterator iter = callbacks.begin(); 274 for (UpdateCallbackList::const_iterator iter = callbacks.begin();
275 iter != callbacks.end(); 275 iter != callbacks.end();
276 ++iter) { 276 ++iter) {
277 const UpdateCheckCallback& callback = *iter; 277 const UpdateCheckCallback& callback = *iter;
278 callback.Run(result); 278 callback.Run(result);
279 } 279 }
280 } 280 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698