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

Side by Side Diff: chrome/browser/extensions/settings/settings_frontend.cc

Issue 10696208: Move ExtensionEventRouter and related into extensions namespace (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fixed bug + latest master Created 8 years, 5 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/settings/settings_frontend.h" 5 #include "chrome/browser/extensions/settings/settings_frontend.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
11 #include "base/file_path.h" 11 #include "base/file_path.h"
12 #include "chrome/browser/extensions/extension_event_names.h" 12 #include "chrome/browser/extensions/event_names.h"
13 #include "chrome/browser/extensions/extension_event_router.h" 13 #include "chrome/browser/extensions/event_router.h"
14 #include "chrome/browser/extensions/extension_service.h" 14 #include "chrome/browser/extensions/extension_service.h"
15 #include "chrome/browser/extensions/settings/leveldb_settings_storage_factory.h" 15 #include "chrome/browser/extensions/settings/leveldb_settings_storage_factory.h"
16 #include "chrome/browser/extensions/settings/managed_value_store_cache.h" 16 #include "chrome/browser/extensions/settings/managed_value_store_cache.h"
17 #include "chrome/browser/extensions/settings/settings_backend.h" 17 #include "chrome/browser/extensions/settings/settings_backend.h"
18 #include "chrome/browser/extensions/settings/sync_or_local_value_store_cache.h" 18 #include "chrome/browser/extensions/settings/sync_or_local_value_store_cache.h"
19 #include "chrome/browser/profiles/profile.h" 19 #include "chrome/browser/profiles/profile.h"
20 #include "chrome/common/extensions/api/storage.h" 20 #include "chrome/common/extensions/api/storage.h"
21 #include "content/public/browser/browser_thread.h" 21 #include "content/public/browser/browser_thread.h"
22 22
23 using content::BrowserThread; 23 using content::BrowserThread;
24 24
25 namespace extensions { 25 namespace extensions {
26 26
27 namespace { 27 namespace {
28 28
29 // Settings change Observer which forwards changes on to the extension 29 // Settings change Observer which forwards changes on to the extension
30 // processes for |profile| and its incognito partner if it exists. 30 // processes for |profile| and its incognito partner if it exists.
31 class DefaultObserver : public SettingsObserver { 31 class DefaultObserver : public SettingsObserver {
32 public: 32 public:
33 explicit DefaultObserver(Profile* profile) : profile_(profile) {} 33 explicit DefaultObserver(Profile* profile) : profile_(profile) {}
34 34
35 // SettingsObserver implementation. 35 // SettingsObserver implementation.
36 virtual void OnSettingsChanged( 36 virtual void OnSettingsChanged(
37 const std::string& extension_id, 37 const std::string& extension_id,
38 settings_namespace::Namespace settings_namespace, 38 settings_namespace::Namespace settings_namespace,
39 const std::string& change_json) OVERRIDE { 39 const std::string& change_json) OVERRIDE {
40 profile_->GetExtensionEventRouter()->DispatchEventToExtension( 40 profile_->GetExtensionEventRouter()->DispatchEventToExtension(
41 extension_id, 41 extension_id,
42 extension_event_names::kOnSettingsChanged, 42 event_names::kOnSettingsChanged,
43 // This is the list of function arguments to pass to the onChanged 43 // This is the list of function arguments to pass to the onChanged
44 // handler of extensions, an array of [changes, settings_namespace]. 44 // handler of extensions, an array of [changes, settings_namespace].
45 std::string("[") + change_json + ",\"" + 45 std::string("[") + change_json + ",\"" +
46 settings_namespace::ToString(settings_namespace) + "\"]", 46 settings_namespace::ToString(settings_namespace) + "\"]",
47 NULL, 47 NULL,
48 GURL()); 48 GURL());
49 } 49 }
50 50
51 private: 51 private:
52 Profile* const profile_; 52 Profile* const profile_;
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 extension_id)); 180 extension_id));
181 } 181 }
182 } 182 }
183 183
184 scoped_refptr<SettingsObserverList> SettingsFrontend::GetObservers() { 184 scoped_refptr<SettingsObserverList> SettingsFrontend::GetObservers() {
185 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 185 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
186 return observers_; 186 return observers_;
187 } 187 }
188 188
189 } // namespace extensions 189 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/script_badge_controller.cc ('k') | chrome/browser/extensions/settings/settings_test_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698