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

Side by Side Diff: chrome/browser/ui/webui/options/core_options_handler.cc

Issue 7327007: Moving notification types which are chrome specific to a new header file chrome_notification_type... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/ui/webui/options/core_options_handler.h" 5 #include "chrome/browser/ui/webui/options/core_options_handler.h"
6 6
7 #include "base/json/json_reader.h" 7 #include "base/json/json_reader.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/string16.h" 9 #include "base/string16.h"
10 #include "base/string_number_conversions.h" 10 #include "base/string_number_conversions.h"
11 #include "base/utf_string_conversions.h" 11 #include "base/utf_string_conversions.h"
12 #include "base/values.h" 12 #include "base/values.h"
13 #include "chrome/browser/browser_process.h" 13 #include "chrome/browser/browser_process.h"
14 #include "chrome/browser/google/google_util.h" 14 #include "chrome/browser/google/google_util.h"
15 #include "chrome/browser/prefs/pref_service.h" 15 #include "chrome/browser/prefs/pref_service.h"
16 #include "chrome/browser/profiles/profile.h" 16 #include "chrome/browser/profiles/profile.h"
17 #include "chrome/common/chrome_notification_types.h"
17 #include "chrome/common/pref_names.h" 18 #include "chrome/common/pref_names.h"
18 #include "chrome/common/url_constants.h" 19 #include "chrome/common/url_constants.h"
19 #include "content/browser/user_metrics.h" 20 #include "content/browser/user_metrics.h"
21 #include "content/common/content_notification_types.h"
20 #include "content/common/notification_details.h" 22 #include "content/common/notification_details.h"
21 #include "content/common/notification_type.h"
22 #include "googleurl/src/gurl.h" 23 #include "googleurl/src/gurl.h"
23 #include "grit/chromium_strings.h" 24 #include "grit/chromium_strings.h"
24 #include "grit/generated_resources.h" 25 #include "grit/generated_resources.h"
25 #include "grit/locale_settings.h" 26 #include "grit/locale_settings.h"
26 #include "grit/theme_resources.h" 27 #include "grit/theme_resources.h"
27 #include "ui/base/l10n/l10n_util.h" 28 #include "ui/base/l10n/l10n_util.h"
28 29
29 CoreOptionsHandler::CoreOptionsHandler() 30 CoreOptionsHandler::CoreOptionsHandler()
30 : handlers_host_(NULL) { 31 : handlers_host_(NULL) {
31 } 32 }
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 } 89 }
89 } 90 }
90 91
91 WebUIMessageHandler* CoreOptionsHandler::Attach(WebUI* web_ui) { 92 WebUIMessageHandler* CoreOptionsHandler::Attach(WebUI* web_ui) {
92 WebUIMessageHandler* result = WebUIMessageHandler::Attach(web_ui); 93 WebUIMessageHandler* result = WebUIMessageHandler::Attach(web_ui);
93 DCHECK(web_ui_); 94 DCHECK(web_ui_);
94 registrar_.Init(web_ui_->GetProfile()->GetPrefs()); 95 registrar_.Init(web_ui_->GetProfile()->GetPrefs());
95 return result; 96 return result;
96 } 97 }
97 98
98 void CoreOptionsHandler::Observe(NotificationType type, 99 void CoreOptionsHandler::Observe(int type,
99 const NotificationSource& source, 100 const NotificationSource& source,
100 const NotificationDetails& details) { 101 const NotificationDetails& details) {
101 if (type == NotificationType::PREF_CHANGED) 102 if (type == chrome::NOTIFICATION_PREF_CHANGED)
102 NotifyPrefChanged(Details<std::string>(details).ptr()); 103 NotifyPrefChanged(Details<std::string>(details).ptr());
103 } 104 }
104 105
105 void CoreOptionsHandler::RegisterMessages() { 106 void CoreOptionsHandler::RegisterMessages() {
106 web_ui_->RegisterMessageCallback("coreOptionsInitialize", 107 web_ui_->RegisterMessageCallback("coreOptionsInitialize",
107 NewCallback(this, &CoreOptionsHandler::HandleInitialize)); 108 NewCallback(this, &CoreOptionsHandler::HandleInitialize));
108 web_ui_->RegisterMessageCallback("fetchPrefs", 109 web_ui_->RegisterMessageCallback("fetchPrefs",
109 NewCallback(this, &CoreOptionsHandler::HandleFetchPrefs)); 110 NewCallback(this, &CoreOptionsHandler::HandleFetchPrefs));
110 web_ui_->RegisterMessageCallback("observePrefs", 111 web_ui_->RegisterMessageCallback("observePrefs",
111 NewCallback(this, &CoreOptionsHandler::HandleObservePrefs)); 112 NewCallback(this, &CoreOptionsHandler::HandleObservePrefs));
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 dict->SetBoolean("managed", pref->IsManaged()); 382 dict->SetBoolean("managed", pref->IsManaged());
382 dict->SetBoolean("extensionControlled", pref->IsExtensionControlled()); 383 dict->SetBoolean("extensionControlled", pref->IsExtensionControlled());
383 dict->SetBoolean("disabled", !pref->IsUserModifiable()); 384 dict->SetBoolean("disabled", !pref->IsUserModifiable());
384 result_value.Append(dict); 385 result_value.Append(dict);
385 386
386 web_ui_->CallJavascriptFunction(WideToASCII(callback_function), 387 web_ui_->CallJavascriptFunction(WideToASCII(callback_function),
387 result_value); 388 result_value);
388 } 389 }
389 } 390 }
390 } 391 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/options/core_options_handler.h ('k') | chrome/browser/ui/webui/options/extension_settings_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698