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

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

Issue 8135001: Fixed behavior of the bookmark bar visibility. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: DCHECK_EQ instead of DCHECK Created 9 years, 2 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/browser_options_handler.h" 5 #include "chrome/browser/ui/webui/options/browser_options_handler.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/bind_helpers.h" 9 #include "base/bind_helpers.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "base/memory/singleton.h" 10 #include "base/memory/singleton.h"
12 #include "base/string_number_conversions.h" 11 #include "base/string_number_conversions.h"
13 #include "base/utf_string_conversions.h" 12 #include "base/utf_string_conversions.h"
14 #include "base/values.h" 13 #include "base/values.h"
15 #include "chrome/browser/autocomplete/autocomplete.h" 14 #include "chrome/browser/autocomplete/autocomplete.h"
16 #include "chrome/browser/autocomplete/autocomplete_match.h" 15 #include "chrome/browser/autocomplete/autocomplete_match.h"
17 #include "chrome/browser/browser_process.h" 16 #include "chrome/browser/browser_process.h"
18 #include "chrome/browser/custom_home_pages_table_model.h" 17 #include "chrome/browser/custom_home_pages_table_model.h"
19 #include "chrome/browser/instant/instant_confirm_dialog.h" 18 #include "chrome/browser/instant/instant_confirm_dialog.h"
20 #include "chrome/browser/instant/instant_controller.h" 19 #include "chrome/browser/instant/instant_controller.h"
21 #include "chrome/browser/instant/instant_field_trial.h" 20 #include "chrome/browser/instant/instant_field_trial.h"
22 #include "chrome/browser/net/url_fixer_upper.h" 21 #include "chrome/browser/net/url_fixer_upper.h"
23 #include "chrome/browser/prefs/pref_service.h" 22 #include "chrome/browser/prefs/pref_service.h"
24 #include "chrome/browser/prefs/session_startup_pref.h" 23 #include "chrome/browser/prefs/session_startup_pref.h"
25 #include "chrome/browser/profiles/profile.h" 24 #include "chrome/browser/profiles/profile.h"
26 #include "chrome/browser/search_engines/template_url.h" 25 #include "chrome/browser/search_engines/template_url.h"
27 #include "chrome/browser/search_engines/template_url_service.h" 26 #include "chrome/browser/search_engines/template_url_service.h"
28 #include "chrome/browser/search_engines/template_url_service_factory.h" 27 #include "chrome/browser/search_engines/template_url_service_factory.h"
29 #include "chrome/browser/ui/webui/favicon_source.h" 28 #include "chrome/browser/ui/webui/favicon_source.h"
30 #include "chrome/common/chrome_notification_types.h" 29 #include "chrome/common/chrome_notification_types.h"
31 #include "chrome/common/pref_names.h" 30 #include "chrome/common/pref_names.h"
32 #include "chrome/common/url_constants.h" 31 #include "chrome/common/url_constants.h"
33 #include "content/browser/browser_thread.h" 32 #include "content/browser/browser_thread.h"
34 #include "content/browser/user_metrics.h" 33 #include "content/browser/user_metrics.h"
35 #include "content/common/notification_details.h" 34 #include "content/common/notification_details.h"
36 #include "content/common/notification_service.h"
37 #include "content/common/notification_source.h" 35 #include "content/common/notification_source.h"
38 #include "grit/chromium_strings.h" 36 #include "grit/chromium_strings.h"
39 #include "grit/generated_resources.h" 37 #include "grit/generated_resources.h"
40 #include "ui/base/l10n/l10n_util.h" 38 #include "ui/base/l10n/l10n_util.h"
41 39
42 BrowserOptionsHandler::BrowserOptionsHandler() 40 BrowserOptionsHandler::BrowserOptionsHandler()
43 : template_url_service_(NULL), startup_custom_pages_table_model_(NULL) { 41 : template_url_service_(NULL), startup_custom_pages_table_model_(NULL) {
44 #if !defined(OS_MACOSX) 42 #if !defined(OS_MACOSX)
45 default_browser_worker_ = new ShellIntegration::DefaultBrowserWorker(this); 43 default_browser_worker_ = new ShellIntegration::DefaultBrowserWorker(this);
46 #endif 44 #endif
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 base::Unretained(this))); 110 base::Unretained(this)));
113 web_ui_->RegisterMessageCallback("setStartupPagesToCurrentPages", 111 web_ui_->RegisterMessageCallback("setStartupPagesToCurrentPages",
114 base::Bind(&BrowserOptionsHandler::SetStartupPagesToCurrentPages, 112 base::Bind(&BrowserOptionsHandler::SetStartupPagesToCurrentPages,
115 base::Unretained(this))); 113 base::Unretained(this)));
116 web_ui_->RegisterMessageCallback("dragDropStartupPage", 114 web_ui_->RegisterMessageCallback("dragDropStartupPage",
117 base::Bind(&BrowserOptionsHandler::DragDropStartupPage, 115 base::Bind(&BrowserOptionsHandler::DragDropStartupPage,
118 base::Unretained(this))); 116 base::Unretained(this)));
119 web_ui_->RegisterMessageCallback("requestAutocompleteSuggestions", 117 web_ui_->RegisterMessageCallback("requestAutocompleteSuggestions",
120 base::Bind(&BrowserOptionsHandler::RequestAutocompleteSuggestions, 118 base::Bind(&BrowserOptionsHandler::RequestAutocompleteSuggestions,
121 base::Unretained(this))); 119 base::Unretained(this)));
122 web_ui_->RegisterMessageCallback("toggleShowBookmarksBar",
123 base::Bind(&BrowserOptionsHandler::ToggleShowBookmarksBar,
124 base::Unretained(this)));
125 web_ui_->RegisterMessageCallback("enableInstant", 120 web_ui_->RegisterMessageCallback("enableInstant",
126 base::Bind(&BrowserOptionsHandler::EnableInstant, 121 base::Bind(&BrowserOptionsHandler::EnableInstant,
127 base::Unretained(this))); 122 base::Unretained(this)));
128 web_ui_->RegisterMessageCallback("disableInstant", 123 web_ui_->RegisterMessageCallback("disableInstant",
129 base::Bind(&BrowserOptionsHandler::DisableInstant, 124 base::Bind(&BrowserOptionsHandler::DisableInstant,
130 base::Unretained(this))); 125 base::Unretained(this)));
131 web_ui_->RegisterMessageCallback("getInstantFieldTrialStatus", 126 web_ui_->RegisterMessageCallback("getInstantFieldTrialStatus",
132 base::Bind(&BrowserOptionsHandler::GetInstantFieldTrialStatus, 127 base::Bind(&BrowserOptionsHandler::GetInstantFieldTrialStatus,
133 base::Unretained(this))); 128 base::Unretained(this)));
134 } 129 }
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 void BrowserOptionsHandler::RequestAutocompleteSuggestions( 442 void BrowserOptionsHandler::RequestAutocompleteSuggestions(
448 const ListValue* args) { 443 const ListValue* args) {
449 string16 input; 444 string16 input;
450 CHECK_EQ(args->GetSize(), 1U); 445 CHECK_EQ(args->GetSize(), 1U);
451 CHECK(args->GetString(0, &input)); 446 CHECK(args->GetString(0, &input));
452 447
453 autocomplete_controller_->Start(input, string16(), true, false, false, 448 autocomplete_controller_->Start(input, string16(), true, false, false,
454 AutocompleteInput::ALL_MATCHES); 449 AutocompleteInput::ALL_MATCHES);
455 } 450 }
456 451
457 void BrowserOptionsHandler::ToggleShowBookmarksBar(const ListValue* args) {
458 Source<Profile> source(Profile::FromWebUI(web_ui_));
459 NotificationService::current()->Notify(
460 chrome::NOTIFICATION_BOOKMARK_BAR_VISIBILITY_PREF_CHANGED,
461 source,
462 NotificationService::NoDetails());
463 }
464
465 void BrowserOptionsHandler::EnableInstant(const ListValue* args) { 452 void BrowserOptionsHandler::EnableInstant(const ListValue* args) {
466 InstantController::Enable(Profile::FromWebUI(web_ui_)); 453 InstantController::Enable(Profile::FromWebUI(web_ui_));
467 } 454 }
468 455
469 void BrowserOptionsHandler::DisableInstant(const ListValue* args) { 456 void BrowserOptionsHandler::DisableInstant(const ListValue* args) {
470 InstantController::Disable(Profile::FromWebUI(web_ui_)); 457 InstantController::Disable(Profile::FromWebUI(web_ui_));
471 } 458 }
472 459
473 void BrowserOptionsHandler::GetInstantFieldTrialStatus(const ListValue* args) { 460 void BrowserOptionsHandler::GetInstantFieldTrialStatus(const ListValue* args) {
474 base::FundamentalValue enabled( 461 base::FundamentalValue enabled(
(...skipping 17 matching lines...) Expand all
492 DictionaryValue* entry = new DictionaryValue(); 479 DictionaryValue* entry = new DictionaryValue();
493 entry->SetString("title", match.description); 480 entry->SetString("title", match.description);
494 entry->SetString("displayURL", match.contents); 481 entry->SetString("displayURL", match.contents);
495 entry->SetString("url", match.destination_url.spec()); 482 entry->SetString("url", match.destination_url.spec());
496 suggestions.Append(entry); 483 suggestions.Append(entry);
497 } 484 }
498 485
499 web_ui_->CallJavascriptFunction( 486 web_ui_->CallJavascriptFunction(
500 "BrowserOptions.updateAutocompleteSuggestions", suggestions); 487 "BrowserOptions.updateAutocompleteSuggestions", suggestions);
501 } 488 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/options/browser_options_handler.h ('k') | chrome/common/chrome_notification_types.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698