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

Side by Side Diff: chrome/browser/ui/browser_instant_controller.cc

Issue 12079097: Introduce PrefRegistrySyncable, simplifying PrefServiceSyncable. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to head again; base::File changes conflicted. Created 7 years, 10 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/ui/browser_instant_controller.h ('k') | chrome/browser/ui/browser_ui_prefs.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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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/browser_instant_controller.h" 5 #include "chrome/browser/ui/browser_instant_controller.h"
6 6
7 #include "chrome/browser/extensions/extension_service.h" 7 #include "chrome/browser/extensions/extension_service.h"
8 #include "chrome/browser/prefs/pref_registry_syncable.h"
8 #include "chrome/browser/prefs/pref_service.h" 9 #include "chrome/browser/prefs/pref_service.h"
9 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/themes/theme_service.h" 11 #include "chrome/browser/themes/theme_service.h"
11 #include "chrome/browser/themes/theme_service_factory.h" 12 #include "chrome/browser/themes/theme_service_factory.h"
12 #include "chrome/browser/ui/browser.h" 13 #include "chrome/browser/ui/browser.h"
13 #include "chrome/browser/ui/browser_window.h" 14 #include "chrome/browser/ui/browser_window.h"
14 #include "chrome/browser/ui/omnibox/location_bar.h" 15 #include "chrome/browser/ui/omnibox/location_bar.h"
15 #include "chrome/browser/ui/omnibox/omnibox_view.h" 16 #include "chrome/browser/ui/omnibox/omnibox_view.h"
16 #include "chrome/browser/ui/search/search.h" 17 #include "chrome/browser/ui/search/search.h"
17 #include "chrome/browser/ui/search/search_tab_helper.h" 18 #include "chrome/browser/ui/search/search_tab_helper.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 67
67 BrowserInstantController::~BrowserInstantController() { 68 BrowserInstantController::~BrowserInstantController() {
68 browser_->search_model()->RemoveObserver(this); 69 browser_->search_model()->RemoveObserver(this);
69 } 70 }
70 71
71 bool BrowserInstantController::IsInstantEnabled(Profile* profile) { 72 bool BrowserInstantController::IsInstantEnabled(Profile* profile) {
72 return profile && !profile->IsOffTheRecord() && profile->GetPrefs() && 73 return profile && !profile->IsOffTheRecord() && profile->GetPrefs() &&
73 profile->GetPrefs()->GetBoolean(GetInstantPrefName(profile)); 74 profile->GetPrefs()->GetBoolean(GetInstantPrefName(profile));
74 } 75 }
75 76
76 void BrowserInstantController::RegisterUserPrefs(PrefServiceSyncable* prefs) { 77 void BrowserInstantController::RegisterUserPrefs(
77 prefs->RegisterBooleanPref(prefs::kInstantConfirmDialogShown, false, 78 PrefService* prefs,
78 PrefServiceSyncable::SYNCABLE_PREF); 79 PrefRegistrySyncable* registry) {
79 prefs->RegisterBooleanPref(prefs::kInstantEnabled, false, 80 // TODO(joi): Get rid of the need for PrefService param above.
80 PrefServiceSyncable::SYNCABLE_PREF); 81 registry->RegisterBooleanPref(prefs::kInstantConfirmDialogShown, false,
82 PrefRegistrySyncable::SYNCABLE_PREF);
83 registry->RegisterBooleanPref(prefs::kInstantEnabled, false,
84 PrefRegistrySyncable::SYNCABLE_PREF);
81 85
82 search::InstantExtendedDefault instant_extended_default_setting = 86 search::InstantExtendedDefault instant_extended_default_setting =
83 search::GetInstantExtendedDefaultSetting(); 87 search::GetInstantExtendedDefaultSetting();
84 88
85 bool instant_extended_value = true; 89 bool instant_extended_value = true;
86 switch (instant_extended_default_setting) { 90 switch (instant_extended_default_setting) {
87 case search::INSTANT_FORCE_ON: 91 case search::INSTANT_FORCE_ON:
88 break; 92 break;
89 case search::INSTANT_USE_EXISTING: 93 case search::INSTANT_USE_EXISTING:
90 instant_extended_value = prefs->GetBoolean(prefs::kInstantEnabled); 94 instant_extended_value = prefs->GetBoolean(prefs::kInstantEnabled);
91 break; 95 break;
92 case search::INSTANT_FORCE_OFF: 96 case search::INSTANT_FORCE_OFF:
93 instant_extended_value = false; 97 instant_extended_value = false;
94 break; 98 break;
95 } 99 }
96 100
97 prefs->RegisterBooleanPref(prefs::kInstantExtendedEnabled, 101 registry->RegisterBooleanPref(prefs::kInstantExtendedEnabled,
98 instant_extended_value, 102 instant_extended_value,
99 PrefServiceSyncable::SYNCABLE_PREF); 103 PrefRegistrySyncable::SYNCABLE_PREF);
100 } 104 }
101 105
102 bool BrowserInstantController::MaybeSwapInInstantNTPContents( 106 bool BrowserInstantController::MaybeSwapInInstantNTPContents(
103 const GURL& url, 107 const GURL& url,
104 content::WebContents* source_contents, 108 content::WebContents* source_contents,
105 content::WebContents** target_contents) { 109 content::WebContents** target_contents) {
106 if (url != GURL(chrome::kChromeUINewTabURL)) 110 if (url != GURL(chrome::kChromeUINewTabURL))
107 return false; 111 return false;
108 112
109 scoped_ptr<content::WebContents> instant_ntp = instant_.ReleaseNTPContents(); 113 scoped_ptr<content::WebContents> instant_ntp = instant_.ReleaseNTPContents();
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 // part of the image overlay should draw, 'cos the origin is top-left. 364 // part of the image overlay should draw, 'cos the origin is top-left.
361 if (!browser_->search_model()->mode().is_ntp() || 365 if (!browser_->search_model()->mode().is_ntp() ||
362 theme_info_.theme_id.empty() || 366 theme_info_.theme_id.empty() ||
363 theme_info_.image_vertical_alignment == THEME_BKGRND_IMAGE_ALIGN_TOP) { 367 theme_info_.image_vertical_alignment == THEME_BKGRND_IMAGE_ALIGN_TOP) {
364 return; 368 return;
365 } 369 }
366 instant_.ThemeAreaHeightChanged(theme_area_height_); 370 instant_.ThemeAreaHeightChanged(theme_area_height_);
367 } 371 }
368 372
369 } // namespace chrome 373 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/ui/browser_instant_controller.h ('k') | chrome/browser/ui/browser_ui_prefs.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698