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

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

Issue 131094: Add GetMessageHandlers to HtmlDialogUIDelegate to allow... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 6 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 | « chrome/browser/dom_ui/shown_sections_handler.h ('k') | chrome/browser/dom_ui/tips_handler.h » ('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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 "base/string_util.h" 7 #include "base/string_util.h"
8 #include "base/values.h" 8 #include "base/values.h"
9 #include "chrome/browser/profile.h" 9 #include "chrome/browser/profile.h"
10 #include "chrome/common/pref_names.h" 10 #include "chrome/common/pref_names.h"
11 11
12 ShownSectionsHandler::ShownSectionsHandler(DOMUI* dom_ui) 12 void ShownSectionsHandler::RegisterMessages() {
13 : DOMMessageHandler(dom_ui), 13 dom_ui_->RegisterMessageCallback("getShownSections",
14 dom_ui_(dom_ui) {
15 dom_ui->RegisterMessageCallback("getShownSections",
16 NewCallback(this, &ShownSectionsHandler::HandleGetShownSections)); 14 NewCallback(this, &ShownSectionsHandler::HandleGetShownSections));
17 dom_ui->RegisterMessageCallback("setShownSections", 15 dom_ui_->RegisterMessageCallback("setShownSections",
18 NewCallback(this, &ShownSectionsHandler::HandleSetShownSections)); 16 NewCallback(this, &ShownSectionsHandler::HandleSetShownSections));
19 } 17 }
20 18
21 void ShownSectionsHandler::HandleGetShownSections(const Value* value) { 19 void ShownSectionsHandler::HandleGetShownSections(const Value* value) {
22 const int mode = dom_ui_->GetProfile()->GetPrefs()-> 20 const int mode = dom_ui_->GetProfile()->GetPrefs()->
23 GetInteger(prefs::kNTPShownSections); 21 GetInteger(prefs::kNTPShownSections);
24 FundamentalValue* mode_value = new FundamentalValue(mode); 22 FundamentalValue* mode_value = new FundamentalValue(mode);
25 dom_ui_->CallJavascriptFunction(L"onShownSections", *mode_value); 23 dom_ui_->CallJavascriptFunction(L"onShownSections", *mode_value);
26 } 24 }
27 25
(...skipping 17 matching lines...) Expand all
45 dom_ui_->GetProfile()->GetPrefs()->SetInteger( 43 dom_ui_->GetProfile()->GetPrefs()->SetInteger(
46 prefs::kNTPShownSections, StringToInt(mode_string)); 44 prefs::kNTPShownSections, StringToInt(mode_string));
47 } 45 }
48 46
49 // static 47 // static
50 void ShownSectionsHandler::RegisterUserPrefs(PrefService* prefs) { 48 void ShownSectionsHandler::RegisterUserPrefs(PrefService* prefs) {
51 prefs->RegisterIntegerPref(prefs::kNTPShownSections, 49 prefs->RegisterIntegerPref(prefs::kNTPShownSections,
52 THUMB | RECENT | TIPS); 50 THUMB | RECENT | TIPS);
53 } 51 }
54 52
OLDNEW
« no previous file with comments | « chrome/browser/dom_ui/shown_sections_handler.h ('k') | chrome/browser/dom_ui/tips_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698