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

Side by Side Diff: chrome/browser/instant/instant_controller.cc

Issue 3809005: Moves instant back into flags. (Closed) Base URL: http://git.chromium.org/git/chromium.git
Patch Set: Created 10 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/instant/instant_controller.h" 5 #include "chrome/browser/instant/instant_controller.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "chrome/browser/autocomplete/autocomplete.h" 8 #include "chrome/browser/autocomplete/autocomplete.h"
9 #include "chrome/browser/instant/instant_delegate.h" 9 #include "chrome/browser/instant/instant_delegate.h"
10 #include "chrome/browser/instant/instant_loader.h" 10 #include "chrome/browser/instant/instant_loader.h"
(...skipping 10 matching lines...) Expand all
21 // Number of ms to delay between loading urls. 21 // Number of ms to delay between loading urls.
22 static const int kUpdateDelayMS = 200; 22 static const int kUpdateDelayMS = 200;
23 23
24 // static 24 // static
25 void InstantController::RegisterUserPrefs(PrefService* prefs) { 25 void InstantController::RegisterUserPrefs(PrefService* prefs) {
26 prefs->RegisterBooleanPref(prefs::kInstantConfirmDialogShown, false); 26 prefs->RegisterBooleanPref(prefs::kInstantConfirmDialogShown, false);
27 prefs->RegisterBooleanPref(prefs::kInstantEnabled, false); 27 prefs->RegisterBooleanPref(prefs::kInstantEnabled, false);
28 } 28 }
29 29
30 // static 30 // static
31 bool InstantController::IsEnabled(Profile* profile) { 31 bool InstantController::IsEnabled() {
32 // TODO: convert to kInstantEnabled once pref lands.
32 static bool enabled = false; 33 static bool enabled = false;
33 static bool checked = false; 34 static bool checked = false;
34 if (!checked) { 35 if (!checked) {
35 checked = true; 36 checked = true;
36 enabled = CommandLine::ForCurrentProcess()->HasSwitch( 37 enabled = CommandLine::ForCurrentProcess()->HasSwitch(
37 switches::kEnableMatchPreview); 38 switches::kEnableMatchPreview);
38 } 39 }
39 PrefService* prefs = profile->GetPrefs(); 40 return enabled;
40 return (enabled || (prefs && prefs->GetBoolean(prefs::kInstantEnabled)));
41 } 41 }
42 42
43 InstantController::InstantController(InstantDelegate* delegate) 43 InstantController::InstantController(InstantDelegate* delegate)
44 : delegate_(delegate), 44 : delegate_(delegate),
45 tab_contents_(NULL), 45 tab_contents_(NULL),
46 is_active_(false), 46 is_active_(false),
47 commit_on_mouse_up_(false), 47 commit_on_mouse_up_(false),
48 last_transition_type_(PageTransition::LINK) { 48 last_transition_type_(PageTransition::LINK) {
49 } 49 }
50 50
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 template_url = model ? model->GetDefaultSearchProvider() : NULL; 320 template_url = model ? model->GetDefaultSearchProvider() : NULL;
321 } 321 }
322 if (template_url && template_url->id() && 322 if (template_url && template_url->id() &&
323 template_url->instant_url() && 323 template_url->instant_url() &&
324 !IsBlacklistedFromInstant(template_url->id()) && 324 !IsBlacklistedFromInstant(template_url->id()) &&
325 template_url->instant_url()->SupportsReplacement()) { 325 template_url->instant_url()->SupportsReplacement()) {
326 return template_url; 326 return template_url;
327 } 327 }
328 return NULL; 328 return NULL;
329 } 329 }
OLDNEW
« no previous file with comments | « chrome/browser/instant/instant_controller.h ('k') | chrome/browser/renderer_host/browser_render_process_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698