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

Side by Side Diff: chrome/browser/ui/browser_instant_controller.h

Issue 11262015: Remove unused / unnecessary stuff from Instant. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove SuggestedTextView entirely Created 8 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 #ifndef CHROME_BROWSER_UI_BROWSER_INSTANT_CONTROLLER_H_ 5 #ifndef CHROME_BROWSER_UI_BROWSER_INSTANT_CONTROLLER_H_
6 #define CHROME_BROWSER_UI_BROWSER_INSTANT_CONTROLLER_H_ 6 #define CHROME_BROWSER_UI_BROWSER_INSTANT_CONTROLLER_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "base/prefs/public/pref_change_registrar.h" 11 #include "base/prefs/public/pref_change_registrar.h"
12 #include "base/string16.h" 12 #include "base/string16.h"
13 #include "chrome/browser/instant/instant_controller_delegate.h"
14 #include "chrome/browser/instant/instant_unload_handler.h" 13 #include "chrome/browser/instant/instant_unload_handler.h"
15 #include "chrome/browser/ui/search/search_model_observer.h" 14 #include "chrome/browser/ui/search/search_model_observer.h"
16 #include "chrome/browser/ui/tabs/tab_strip_model_observer.h" 15 #include "chrome/browser/ui/tabs/tab_strip_model_observer.h"
17 #include "chrome/common/instant_types.h" 16 #include "chrome/common/instant_types.h"
18 #include "content/public/browser/notification_observer.h" 17 #include "content/public/browser/notification_observer.h"
19 #include "webkit/glue/window_open_disposition.h" 18 #include "webkit/glue/window_open_disposition.h"
20 19
21 class Browser; 20 class Browser;
22 class InstantController; 21 class InstantController;
23 class InstantTest; 22 class InstantTest;
24 class TabContents; 23 class TabContents;
25 24
26 namespace content { 25 namespace content {
27 class NotificationDetails; 26 class NotificationDetails;
28 class NotificationSource; 27 class NotificationSource;
29 } 28 }
30 29
31 namespace gfx { 30 namespace gfx {
32 class Rect; 31 class Rect;
33 } 32 }
34 33
35 namespace chrome { 34 namespace chrome {
36 35
37 class BrowserInstantController : public InstantControllerDelegate, 36 class BrowserInstantController : public TabStripModelObserver,
38 public TabStripModelObserver,
39 public search::SearchModelObserver, 37 public search::SearchModelObserver,
40 public content::NotificationObserver { 38 public content::NotificationObserver {
41 public: 39 public:
42 explicit BrowserInstantController(Browser* browser); 40 explicit BrowserInstantController(Browser* browser);
43 virtual ~BrowserInstantController(); 41 virtual ~BrowserInstantController();
44 42
45 // Commits the current Instant, returning true on success. This is intended 43 // Commits the current Instant, returning true on success. This is intended
46 // for use from OpenCurrentURL. 44 // for use from OpenCurrentURL.
47 bool OpenInstant(WindowOpenDisposition disposition); 45 bool OpenInstant(WindowOpenDisposition disposition);
48 46
49 // Returns the InstantController or NULL if there is no InstantController for 47 // Returns the InstantController or NULL if there is no InstantController for
50 // this BrowserInstantController. 48 // this BrowserInstantController.
51 InstantController* instant() const { return instant_.get(); } 49 InstantController* instant() const { return instant_.get(); }
52 50
53 private: 51 // Invoked by |instant_| to commit the |preview| by merging it into the active
54 // Overridden from InstantControllerDelegate: 52 // tab or adding it as a new tab. We take ownership of |preview|.
55 virtual void CommitInstant(TabContents* preview, bool in_new_tab) OVERRIDE; 53 void CommitInstant(TabContents* preview, bool in_new_tab);
56 virtual void SetInstantSuggestion( 54
57 const InstantSuggestion& suggestion) OVERRIDE; 55 // Invoked by |instant_| to autocomplete the |suggestion| into the omnibox.
58 virtual gfx::Rect GetInstantBounds() OVERRIDE; 56 void SetInstantSuggestion(const InstantSuggestion& suggestion);
59 virtual void InstantPreviewFocused() OVERRIDE; 57
60 virtual TabContents* GetActiveTabContents() const OVERRIDE; 58 // Invoked by |instant_| to get the bounds that the preview is placed at,
59 // in screen coordinated.
60 gfx::Rect GetInstantBounds();
61
62 // Invoked by |instant_| to notify that the preview gained focus, usually due
63 // to the user clicking on it.
64 void InstantPreviewFocused();
65
66 // Invoked by |instant_| to get the currently active tab, over which the
67 // preview would be shown.
68 TabContents* GetActiveTabContents() const;
61 69
62 // Overridden from content::NotificationObserver: 70 // Overridden from content::NotificationObserver:
63 virtual void Observe(int type, 71 virtual void Observe(int type,
64 const content::NotificationSource& source, 72 const content::NotificationSource& source,
65 const content::NotificationDetails& details) OVERRIDE; 73 const content::NotificationDetails& details) OVERRIDE;
66 74
67 // Overridden from TabStripModelObserver: 75 // Overridden from TabStripModelObserver:
68 virtual void TabDeactivated(TabContents* contents) OVERRIDE; 76 virtual void TabDeactivated(TabContents* contents) OVERRIDE;
69 77
70 // Overridden from search::SearchModelObserver: 78 // Overridden from search::SearchModelObserver:
71 virtual void ModeChanged(const search::Mode& old_mode, 79 virtual void ModeChanged(const search::Mode& old_mode,
72 const search::Mode& new_mode) OVERRIDE; 80 const search::Mode& new_mode) OVERRIDE;
73 81
74 // If this browser should have Instant, a new InstantController created; 82 // If this browser should have Instant, a new InstantController created;
75 // otherwise any existing InstantController is destroyed. 83 // otherwise any existing InstantController is destroyed.
76 void ResetInstant(); 84 void ResetInstant();
77 85
78 Browser* browser_; 86 Browser* browser_;
79 87
80 scoped_ptr<InstantController> instant_; 88 scoped_ptr<InstantController> instant_;
81 InstantUnloadHandler instant_unload_handler_; 89 InstantUnloadHandler instant_unload_handler_;
82 90
83 PrefChangeRegistrar profile_pref_registrar_; 91 PrefChangeRegistrar profile_pref_registrar_;
84 92
85 DISALLOW_IMPLICIT_CONSTRUCTORS(BrowserInstantController); 93 DISALLOW_COPY_AND_ASSIGN(BrowserInstantController);
86 }; 94 };
87 95
88 } // namespace chrome 96 } // namespace chrome
89 97
90 #endif // CHROME_BROWSER_UI_BROWSER_INSTANT_CONTROLLER_H_ 98 #endif // CHROME_BROWSER_UI_BROWSER_INSTANT_CONTROLLER_H_
OLDNEW
« no previous file with comments | « chrome/browser/instant/instant_unload_handler.cc ('k') | chrome/browser/ui/browser_instant_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698