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 switch (instant_extended_default_setting) { |
| 83 case search::INSTANT_FORCE_ON: |
| 84 break; |
| 85 case search::INSTANT_USE_EXISTING: |
| 86 instant_extended_value = prefs->GetBoolean(prefs::kInstantEnabled); |
| 87 break; |
| 88 case search::INSTANT_FORCE_OFF: |
| 89 instant_extended_value = false; |
| 90 break; |
| 91 } |
| 92 |
| 93 prefs->RegisterBooleanPref(prefs::kInstantExtendedEnabled, |
| 94 instant_extended_value, |
78 PrefServiceSyncable::SYNCABLE_PREF); | 95 PrefServiceSyncable::SYNCABLE_PREF); |
79 } | 96 } |
80 | 97 |
81 bool BrowserInstantController::OpenInstant(WindowOpenDisposition disposition) { | 98 bool BrowserInstantController::OpenInstant(WindowOpenDisposition disposition) { |
82 // Unsupported dispositions. | 99 // Unsupported dispositions. |
83 if (disposition == NEW_BACKGROUND_TAB || disposition == NEW_WINDOW) | 100 if (disposition == NEW_BACKGROUND_TAB || disposition == NEW_WINDOW) |
84 return false; | 101 return false; |
85 | 102 |
86 // The omnibox currently doesn't use other dispositions, so we don't attempt | 103 // 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 | 104 // 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. | 313 // part of the image overlay should draw, 'cos the origin is top-left. |
297 if (!browser_->search_model()->mode().is_ntp() || | 314 if (!browser_->search_model()->mode().is_ntp() || |
298 theme_info_.theme_id.empty() || | 315 theme_info_.theme_id.empty() || |
299 theme_info_.image_vertical_alignment == THEME_BKGRND_IMAGE_ALIGN_TOP) { | 316 theme_info_.image_vertical_alignment == THEME_BKGRND_IMAGE_ALIGN_TOP) { |
300 return; | 317 return; |
301 } | 318 } |
302 instant_.ThemeAreaHeightChanged(theme_area_height_); | 319 instant_.ThemeAreaHeightChanged(theme_area_height_); |
303 } | 320 } |
304 | 321 |
305 } // namespace chrome | 322 } // namespace chrome |
OLD | NEW |