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

Side by Side Diff: chrome/browser/ui/search/search_tab_helper.h

Issue 10837240: Search state transitions not working (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: OVERRIDE Created 8 years, 4 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
« no previous file with comments | « chrome/browser/ui/search/search_model.cc ('k') | chrome/browser/ui/search/search_tab_helper.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_SEARCH_SEARCH_TAB_HELPER_H_ 5 #ifndef CHROME_BROWSER_UI_SEARCH_SEARCH_TAB_HELPER_H_
6 #define CHROME_BROWSER_UI_SEARCH_SEARCH_TAB_HELPER_H_ 6 #define CHROME_BROWSER_UI_SEARCH_SEARCH_TAB_HELPER_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "chrome/browser/ui/search/search_model.h" 9 #include "chrome/browser/ui/search/search_model.h"
10 #include "content/public/browser/notification_observer.h" 10 #include "content/public/browser/notification_observer.h"
11 #include "content/public/browser/notification_registrar.h" 11 #include "content/public/browser/notification_registrar.h"
12 #include "content/public/browser/web_contents_observer.h" 12 #include "content/public/browser/web_contents_observer.h"
13 13
14 class OmniboxEditModel; 14 class OmniboxEditModel;
15 class TabContents; 15 class TabContents;
16 16
17 namespace content {
18 class WebContents;
19 }
20
17 namespace chrome { 21 namespace chrome {
18 namespace search { 22 namespace search {
19 23
20 // Per-tab search "helper". Acts as the owner and controller of the tab's 24 // Per-tab search "helper". Acts as the owner and controller of the tab's
21 // search UI model. 25 // search UI model.
22 class SearchTabHelper : public content::WebContentsObserver, 26 class SearchTabHelper : public content::WebContentsObserver,
23 public content::NotificationObserver { 27 public content::NotificationObserver {
24 public: 28 public:
25 SearchTabHelper(TabContents* contents, bool is_search_enabled); 29 SearchTabHelper(TabContents* contents, bool is_search_enabled);
26 virtual ~SearchTabHelper(); 30 virtual ~SearchTabHelper();
27 31
28 SearchModel* model() { 32 SearchModel* model() {
29 return &model_; 33 return &model_;
30 } 34 }
31 35
32 // Invoked when the OmniboxEditModel changes state in some way that might 36 // Invoked when the OmniboxEditModel changes state in some way that might
33 // affect the search mode. 37 // affect the search mode.
34 void OmniboxEditModelChanged(OmniboxEditModel* edit_model); 38 void OmniboxEditModelChanged(bool user_input_in_progress, bool cancelling);
35 39
36 // content::WebContentsObserver overrides: 40 // Overridden from contents::WebContentsObserver:
37 virtual void NavigateToPendingEntry( 41 virtual void NavigateToPendingEntry(
38 const GURL& url, 42 const GURL& url,
39 content::NavigationController::ReloadType reload_type) OVERRIDE; 43 content::NavigationController::ReloadType reload_type) OVERRIDE;
40 44
41 // Overridden from content::NotificationObserver: 45 // Overridden from content::NotificationObserver:
42 virtual void Observe(int type, 46 virtual void Observe(int type,
43 const content::NotificationSource& source, 47 const content::NotificationSource& source,
44 const content::NotificationDetails& details) OVERRIDE; 48 const content::NotificationDetails& details) OVERRIDE;
45 49
46 private: 50 private:
47 // Sets the mode of the model based on |url|. 51 // Sets the mode of the model based on |url|. |animate| is based on initial
48 // |animate| is set in the Mode passed to the model. 52 // navigation and used for the mode change on the |model_|.
49 void UpdateModel(const GURL& url, bool animate); 53 void UpdateModelBasedOnURL(const GURL& url, bool animate);
54
55 content::WebContents* web_contents();
50 56
51 const bool is_search_enabled_; 57 const bool is_search_enabled_;
52 58
53 // Model object for UI that cares about search state. 59 // Model object for UI that cares about search state.
54 SearchModel model_; 60 SearchModel model_;
55 61
56 content::NotificationRegistrar registrar_; 62 content::NotificationRegistrar registrar_;
57 63
58 DISALLOW_COPY_AND_ASSIGN(SearchTabHelper); 64 DISALLOW_COPY_AND_ASSIGN(SearchTabHelper);
59 }; 65 };
60 66
61 } // namespace search 67 } // namespace search
62 } // namespace chrome 68 } // namespace chrome
63 69
64 #endif // CHROME_BROWSER_UI_SEARCH_SEARCH_TAB_HELPER_H_ 70 #endif // CHROME_BROWSER_UI_SEARCH_SEARCH_TAB_HELPER_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/search/search_model.cc ('k') | chrome/browser/ui/search/search_tab_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698