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

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

Issue 5023001: Handful of related instant changes: (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix linux build Created 10 years, 1 month 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 #ifndef CHROME_BROWSER_INSTANT_INSTANT_CONTROLLER_H_ 5 #ifndef CHROME_BROWSER_INSTANT_INSTANT_CONTROLLER_H_
6 #define CHROME_BROWSER_INSTANT_INSTANT_CONTROLLER_H_ 6 #define CHROME_BROWSER_INSTANT_INSTANT_CONTROLLER_H_
7 #pragma once 7 #pragma once
8 8
9 #include <set> 9 #include <set>
10 10
(...skipping 22 matching lines...) Expand all
33 // 33 //
34 // At any time the TabContents maintained by InstantController may be destroyed 34 // At any time the TabContents maintained by InstantController may be destroyed
35 // by way of |DestroyPreviewContents|, which results in |HideInstant| being 35 // by way of |DestroyPreviewContents|, which results in |HideInstant| being
36 // invoked on the delegate. Similarly the preview may be committed at any time 36 // invoked on the delegate. Similarly the preview may be committed at any time
37 // by invoking |CommitCurrentPreview|, which results in |CommitInstant| 37 // by invoking |CommitCurrentPreview|, which results in |CommitInstant|
38 // being invoked on the delegate. 38 // being invoked on the delegate.
39 class InstantController : public InstantLoaderDelegate { 39 class InstantController : public InstantLoaderDelegate {
40 public: 40 public:
41 // Variations of instant support. 41 // Variations of instant support.
42 enum Type { 42 enum Type {
43 // NOTE: these values are persisted to prefs. Don't change them!
44
43 // Search results are shown for the best guess of what we think the user was 45 // Search results are shown for the best guess of what we think the user was
44 // planning on typing. 46 // planning on typing.
45 PREDICTIVE_TYPE, 47 PREDICTIVE_TYPE = 0,
46 48
47 // Search results are shown for exactly what was typed. 49 // Search results are shown for exactly what was typed.
48 VERBATIM_TYPE, 50 VERBATIM_TYPE,
51
52 LAST_TYPE = VERBATIM_TYPE,
49 }; 53 };
50 54
51 InstantController(Profile* profile, InstantDelegate* delegate); 55 InstantController(Profile* profile, InstantDelegate* delegate);
52 ~InstantController(); 56 ~InstantController();
53 57
54 // Registers instant related preferences. 58 // Registers instant related preferences.
55 static void RegisterUserPrefs(PrefService* prefs); 59 static void RegisterUserPrefs(PrefService* prefs);
56 60
61 // Records instant metrics.
62 static void RecordMetrics(Profile* profile);
63
57 // Returns true if either type of instant is enabled. 64 // Returns true if either type of instant is enabled.
58 static bool IsEnabled(Profile* profile); 65 static bool IsEnabled(Profile* profile);
59 66
60 // Returns true if the specified type of instant is enabled. 67 // Returns true if the specified type of instant is enabled.
61 static bool IsEnabled(Profile* profile, Type type); 68 static bool IsEnabled(Profile* profile, Type type);
62 69
70 // Enables instant.
71 static void Enable(Profile* profile);
72
73 // Disables instant.
74 static void Disable(Profile* profile);
75
63 // Invoked as the user types in the omnibox with the url to navigate to. If 76 // Invoked as the user types in the omnibox with the url to navigate to. If
64 // the url is empty and there is a preview TabContents it is destroyed. If url 77 // the url is empty and there is a preview TabContents it is destroyed. If url
65 // is non-empty and the preview TabContents has not been created it is 78 // is non-empty and the preview TabContents has not been created it is
66 // created. 79 // created.
67 void Update(TabContents* tab_contents, 80 void Update(TabContents* tab_contents,
68 const AutocompleteMatch& match, 81 const AutocompleteMatch& match,
69 const string16& user_text, 82 const string16& user_text,
70 string16* suggested_text); 83 string16* suggested_text);
71 84
72 // Sets the bounds of the omnibox (in screen coordinates). The bounds are 85 // Sets the bounds of the omnibox (in screen coordinates). The bounds are
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 220
208 // URL last pased to ScheduleUpdate. 221 // URL last pased to ScheduleUpdate.
209 GURL scheduled_url_; 222 GURL scheduled_url_;
210 223
211 const Type type_; 224 const Type type_;
212 225
213 DISALLOW_COPY_AND_ASSIGN(InstantController); 226 DISALLOW_COPY_AND_ASSIGN(InstantController);
214 }; 227 };
215 228
216 #endif // CHROME_BROWSER_INSTANT_INSTANT_CONTROLLER_H_ 229 #endif // CHROME_BROWSER_INSTANT_INSTANT_CONTROLLER_H_
OLDNEW
« no previous file with comments | « chrome/browser/instant/instant_confirm_dialog.cc ('k') | chrome/browser/instant/instant_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698