Chromium Code Reviews| OLD | NEW |
|---|---|
| 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_service.h" | 8 #include "chrome/browser/prefs/pref_service.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/themes/theme_service.h" | 10 #include "chrome/browser/themes/theme_service.h" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 65 } | 65 } |
| 66 | 66 |
| 67 bool BrowserInstantController::IsInstantEnabled(Profile* profile) { | 67 bool BrowserInstantController::IsInstantEnabled(Profile* profile) { |
| 68 return profile && !profile->IsOffTheRecord() && profile->GetPrefs() && | 68 return profile && !profile->IsOffTheRecord() && profile->GetPrefs() && |
| 69 profile->GetPrefs()->GetBoolean(GetInstantPrefName(profile)); | 69 profile->GetPrefs()->GetBoolean(GetInstantPrefName(profile)); |
| 70 } | 70 } |
| 71 | 71 |
| 72 void BrowserInstantController::RegisterUserPrefs(PrefServiceSyncable* prefs) { | 72 void BrowserInstantController::RegisterUserPrefs(PrefServiceSyncable* prefs) { |
| 73 prefs->RegisterBooleanPref(prefs::kInstantConfirmDialogShown, false, | 73 prefs->RegisterBooleanPref(prefs::kInstantConfirmDialogShown, false, |
| 74 PrefServiceSyncable::SYNCABLE_PREF); | 74 PrefServiceSyncable::SYNCABLE_PREF); |
| 75 prefs->RegisterBooleanPref(prefs::kInstantExtendedEnabled, true, | 75 prefs->RegisterBooleanPref(prefs::kInstantEnabled, false, |
| 76 PrefServiceSyncable::SYNCABLE_PREF); | 76 PrefServiceSyncable::SYNCABLE_PREF); |
| 77 prefs->RegisterBooleanPref(prefs::kInstantEnabled, false, | 77 |
| 78 search::InstantExtendedDefault instant_extended_default_setting = | |
| 79 search::GetInstantExtendedDefaultSetting(); | |
| 80 | |
| 81 bool instant_extended_value = true; | |
| 82 if (instant_extended_default_setting == search::INSTANT_FORCE_OFF) { | |
| 83 instant_extended_value = false; | |
| 84 } else if (instant_extended_default_setting == search::INSTANT_USE_EXISTING) { | |
|
MAD
2013/01/31 15:44:57
No need for {} here... All one liners...
robertshield
2013/01/31 18:56:52
Done.
| |
| 85 instant_extended_value = prefs->GetBoolean(prefs::kInstantEnabled); | |
| 86 } | |
| 87 | |
| 88 prefs->RegisterBooleanPref(prefs::kInstantExtendedEnabled, | |
| 89 instant_extended_value, | |
| 78 PrefServiceSyncable::SYNCABLE_PREF); | 90 PrefServiceSyncable::SYNCABLE_PREF); |
| 79 } | 91 } |
| 80 | 92 |
| 81 bool BrowserInstantController::OpenInstant(WindowOpenDisposition disposition) { | 93 bool BrowserInstantController::OpenInstant(WindowOpenDisposition disposition) { |
| 82 // Unsupported dispositions. | 94 // Unsupported dispositions. |
| 83 if (disposition == NEW_BACKGROUND_TAB || disposition == NEW_WINDOW) | 95 if (disposition == NEW_BACKGROUND_TAB || disposition == NEW_WINDOW) |
| 84 return false; | 96 return false; |
| 85 | 97 |
| 86 // The omnibox currently doesn't use other dispositions, so we don't attempt | 98 // The omnibox currently doesn't use other dispositions, so we don't attempt |
| 87 // to handle them. If you hit this DCHECK file a bug and I'll (sky) add | 99 // to handle them. If you hit this DCHECK file a bug and I'll (sky) add |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 296 // part of the image overlay should draw, 'cos the origin is top-left. | 308 // part of the image overlay should draw, 'cos the origin is top-left. |
| 297 if (!browser_->search_model()->mode().is_ntp() || | 309 if (!browser_->search_model()->mode().is_ntp() || |
| 298 theme_info_.theme_id.empty() || | 310 theme_info_.theme_id.empty() || |
| 299 theme_info_.image_vertical_alignment == THEME_BKGRND_IMAGE_ALIGN_TOP) { | 311 theme_info_.image_vertical_alignment == THEME_BKGRND_IMAGE_ALIGN_TOP) { |
| 300 return; | 312 return; |
| 301 } | 313 } |
| 302 instant_.ThemeAreaHeightChanged(theme_area_height_); | 314 instant_.ThemeAreaHeightChanged(theme_area_height_); |
| 303 } | 315 } |
| 304 | 316 |
| 305 } // namespace chrome | 317 } // namespace chrome |
| OLD | NEW |