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

Side by Side Diff: chrome/browser/ui/webui/options2/home_page_overlay_handler2.cc

Issue 9994005: Separate handler initialization from page initialization (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: move anything that indirectly calls JS to InitializePage Created 8 years, 8 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) 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/ui/webui/options2/home_page_overlay_handler2.h" 5 #include "chrome/browser/ui/webui/options2/home_page_overlay_handler2.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "chrome/browser/autocomplete/autocomplete.h" 9 #include "chrome/browser/autocomplete/autocomplete.h"
10 #include "chrome/browser/autocomplete/autocomplete_controller_delegate.h" 10 #include "chrome/browser/autocomplete/autocomplete_controller_delegate.h"
(...skipping 12 matching lines...) Expand all
23 HomePageOverlayHandler::~HomePageOverlayHandler() { 23 HomePageOverlayHandler::~HomePageOverlayHandler() {
24 } 24 }
25 25
26 void HomePageOverlayHandler::RegisterMessages() { 26 void HomePageOverlayHandler::RegisterMessages() {
27 web_ui()->RegisterMessageCallback( 27 web_ui()->RegisterMessageCallback(
28 "requestAutocompleteSuggestionsForHomePage", 28 "requestAutocompleteSuggestionsForHomePage",
29 base::Bind(&HomePageOverlayHandler::RequestAutocompleteSuggestions, 29 base::Bind(&HomePageOverlayHandler::RequestAutocompleteSuggestions,
30 base::Unretained(this))); 30 base::Unretained(this)));
31 } 31 }
32 32
33 void HomePageOverlayHandler::InitializeHandler() { 33 void HomePageOverlayHandler::InitializePage() {
34 Profile* profile = Profile::FromWebUI(web_ui()); 34 Profile* profile = Profile::FromWebUI(web_ui());
35 autocomplete_controller_.reset(new AutocompleteController(profile, this)); 35 autocomplete_controller_.reset(new AutocompleteController(profile, this));
36 } 36 }
37 37
38 void HomePageOverlayHandler::GetLocalizedValues( 38 void HomePageOverlayHandler::GetLocalizedValues(
39 base::DictionaryValue* localized_strings) { 39 base::DictionaryValue* localized_strings) {
40 RegisterTitle(localized_strings, "homePageOverlay", 40 RegisterTitle(localized_strings, "homePageOverlay",
41 IDS_OPTIONS2_HOMEPAGE_TITLE); 41 IDS_OPTIONS2_HOMEPAGE_TITLE);
42 localized_strings->SetString( 42 localized_strings->SetString(
43 "homePageDialogLabel", 43 "homePageDialogLabel",
(...skipping 12 matching lines...) Expand all
56 56
57 void HomePageOverlayHandler::OnResultChanged(bool default_match_changed) { 57 void HomePageOverlayHandler::OnResultChanged(bool default_match_changed) {
58 const AutocompleteResult& result = autocomplete_controller_->result(); 58 const AutocompleteResult& result = autocomplete_controller_->result();
59 base::ListValue suggestions; 59 base::ListValue suggestions;
60 OptionsUI::ProcessAutocompleteSuggestions(result, &suggestions); 60 OptionsUI::ProcessAutocompleteSuggestions(result, &suggestions);
61 web_ui()->CallJavascriptFunction( 61 web_ui()->CallJavascriptFunction(
62 "HomePageOverlay.updateAutocompleteSuggestions", suggestions); 62 "HomePageOverlay.updateAutocompleteSuggestions", suggestions);
63 } 63 }
64 64
65 } // namespace options2 65 } // namespace options2
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698