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

Side by Side Diff: chrome/browser/dom_ui/shown_sections_handler.cc

Issue 6254018: Allow chrome.send to pass number, boolean, null and arrays of those (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rename function and fix indentation Created 9 years, 11 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
« no previous file with comments | « no previous file | chrome/browser/resources/new_new_tab.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/dom_ui/shown_sections_handler.h" 5 #include "chrome/browser/dom_ui/shown_sections_handler.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 } 84 }
85 } 85 }
86 86
87 void ShownSectionsHandler::HandleGetShownSections(const ListValue* args) { 87 void ShownSectionsHandler::HandleGetShownSections(const ListValue* args) {
88 int sections = GetShownSections(pref_service_); 88 int sections = GetShownSections(pref_service_);
89 FundamentalValue sections_value(sections); 89 FundamentalValue sections_value(sections);
90 dom_ui_->CallJavascriptFunction(L"onShownSections", sections_value); 90 dom_ui_->CallJavascriptFunction(L"onShownSections", sections_value);
91 } 91 }
92 92
93 void ShownSectionsHandler::HandleSetShownSections(const ListValue* args) { 93 void ShownSectionsHandler::HandleSetShownSections(const ListValue* args) {
94 int mode; 94 double mode;
95 CHECK(ExtractIntegerValue(args, &mode)); 95 CHECK(args->GetReal(0, &mode));
arv (Not doing code reviews) 2011/01/25 18:17:04 I'm going to do another patch to rename this to Ge
96 int old_mode = pref_service_->GetInteger(prefs::kNTPShownSections); 96 int old_mode = pref_service_->GetInteger(prefs::kNTPShownSections);
97 97
98 if (old_mode != mode) { 98 if (old_mode != mode) {
99 NotifySectionDisabled(mode, old_mode, dom_ui_->GetProfile()); 99 NotifySectionDisabled(mode, old_mode, dom_ui_->GetProfile());
100 pref_service_->SetInteger(prefs::kNTPShownSections, mode); 100 pref_service_->SetInteger(prefs::kNTPShownSections, mode);
101 } 101 }
102 } 102 }
103 103
104 // static 104 // static
105 void ShownSectionsHandler::RegisterUserPrefs(PrefService* pref_service) { 105 void ShownSectionsHandler::RegisterUserPrefs(PrefService* pref_service) {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 152
153 // Hide any open sections. 153 // Hide any open sections.
154 mode &= ~ALL_SECTIONS_MASK; 154 mode &= ~ALL_SECTIONS_MASK;
155 155
156 // Show the apps section. 156 // Show the apps section.
157 mode |= APPS; 157 mode |= APPS;
158 158
159 prefs->SetInteger(prefs::kNTPShownSections, mode); 159 prefs->SetInteger(prefs::kNTPShownSections, mode);
160 } 160 }
161 } 161 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/new_new_tab.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698