| 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 "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
| 8 #include "chrome/browser/extensions/extension_service.h" | 8 #include "chrome/browser/extensions/extension_service.h" |
| 9 #include "chrome/browser/prefs/pref_registry_syncable.h" | 9 #include "chrome/browser/prefs/pref_registry_syncable.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 | 76 |
| 77 void BrowserInstantController::RegisterUserPrefs( | 77 void BrowserInstantController::RegisterUserPrefs( |
| 78 PrefService* prefs, | 78 PrefService* prefs, |
| 79 PrefRegistrySyncable* registry) { | 79 PrefRegistrySyncable* registry) { |
| 80 // TODO(joi): Get rid of the need for PrefService param above. | 80 // TODO(joi): Get rid of the need for PrefService param above. |
| 81 registry->RegisterBooleanPref(prefs::kInstantConfirmDialogShown, false, | 81 registry->RegisterBooleanPref(prefs::kInstantConfirmDialogShown, false, |
| 82 PrefRegistrySyncable::SYNCABLE_PREF); | 82 PrefRegistrySyncable::SYNCABLE_PREF); |
| 83 registry->RegisterBooleanPref(prefs::kInstantEnabled, false, | 83 registry->RegisterBooleanPref(prefs::kInstantEnabled, false, |
| 84 PrefRegistrySyncable::SYNCABLE_PREF); | 84 PrefRegistrySyncable::SYNCABLE_PREF); |
| 85 | 85 |
| 86 search::InstantExtendedDefault instant_extended_default_setting = | 86 bool instant_extended_default = true; |
| 87 search::GetInstantExtendedDefaultSetting(); | 87 switch (search::GetInstantExtendedDefaultSetting()) { |
| 88 | 88 case search::INSTANT_DEFAULT_ON: |
| 89 bool instant_extended_value = true; | 89 instant_extended_default = true; |
| 90 switch (instant_extended_default_setting) { | |
| 91 case search::INSTANT_FORCE_ON: | |
| 92 break; | 90 break; |
| 93 case search::INSTANT_USE_EXISTING: | 91 case search::INSTANT_USE_EXISTING: |
| 94 instant_extended_value = prefs->GetBoolean(prefs::kInstantEnabled); | 92 instant_extended_default = prefs->GetBoolean(prefs::kInstantEnabled); |
| 95 break; | 93 break; |
| 96 case search::INSTANT_FORCE_OFF: | 94 case search::INSTANT_DEFAULT_OFF: |
| 97 instant_extended_value = false; | 95 instant_extended_default = false; |
| 98 break; | 96 break; |
| 99 } | 97 } |
| 100 | 98 |
| 101 registry->RegisterBooleanPref(prefs::kInstantExtendedEnabled, | 99 registry->RegisterBooleanPref(prefs::kInstantExtendedEnabled, |
| 102 instant_extended_value, | 100 instant_extended_default, |
| 103 PrefRegistrySyncable::SYNCABLE_PREF); | 101 PrefRegistrySyncable::SYNCABLE_PREF); |
| 104 } | 102 } |
| 105 | 103 |
| 106 bool BrowserInstantController::MaybeSwapInInstantNTPContents( | 104 bool BrowserInstantController::MaybeSwapInInstantNTPContents( |
| 107 const GURL& url, | 105 const GURL& url, |
| 108 content::WebContents* source_contents, | 106 content::WebContents* source_contents, |
| 109 content::WebContents** target_contents) { | 107 content::WebContents** target_contents) { |
| 110 if (url != GURL(chrome::kChromeUINewTabURL)) | 108 if (url != GURL(chrome::kChromeUINewTabURL)) |
| 111 return false; | 109 return false; |
| 112 | 110 |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 // part of the image overlay should draw, 'cos the origin is top-left. | 362 // part of the image overlay should draw, 'cos the origin is top-left. |
| 365 if (!browser_->search_model()->mode().is_ntp() || | 363 if (!browser_->search_model()->mode().is_ntp() || |
| 366 theme_info_.theme_id.empty() || | 364 theme_info_.theme_id.empty() || |
| 367 theme_info_.image_vertical_alignment == THEME_BKGRND_IMAGE_ALIGN_TOP) { | 365 theme_info_.image_vertical_alignment == THEME_BKGRND_IMAGE_ALIGN_TOP) { |
| 368 return; | 366 return; |
| 369 } | 367 } |
| 370 instant_.ThemeAreaHeightChanged(theme_area_height_); | 368 instant_.ThemeAreaHeightChanged(theme_area_height_); |
| 371 } | 369 } |
| 372 | 370 |
| 373 } // namespace chrome | 371 } // namespace chrome |
| OLD | NEW |