OLD | NEW |
---|---|
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 "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "chrome/browser/ui/search/search_model.h" | 10 #include "chrome/browser/ui/search/search_model.h" |
(...skipping 23 matching lines...) Expand all Loading... | |
34 return &model_; | 34 return &model_; |
35 } | 35 } |
36 | 36 |
37 // Lazily create web contents for NTP. Owned by SearchTabHelper. | 37 // Lazily create web contents for NTP. Owned by SearchTabHelper. |
38 content::WebContents* GetNTPWebContents(); | 38 content::WebContents* GetNTPWebContents(); |
39 | 39 |
40 // Invoked when the OmniboxEditModel changes state in some way that might | 40 // Invoked when the OmniboxEditModel changes state in some way that might |
41 // affect the search mode. | 41 // affect the search mode. |
42 void OmniboxEditModelChanged(OmniboxEditModel* edit_model); | 42 void OmniboxEditModelChanged(OmniboxEditModel* edit_model); |
43 | 43 |
44 // content::WebContentsObserver overrides: | |
45 virtual void NavigateToPendingEntry( | |
46 const GURL& url, | |
47 content::NavigationController::ReloadType reload_type) OVERRIDE; | |
48 | |
49 // Overridden from content::NotificationObserver: | 44 // Overridden from content::NotificationObserver: |
50 virtual void Observe(int type, | 45 virtual void Observe(int type, |
51 const content::NotificationSource& source, | 46 const content::NotificationSource& source, |
52 const content::NotificationDetails& details) OVERRIDE; | 47 const content::NotificationDetails& details) OVERRIDE; |
53 | 48 |
54 private: | 49 private: |
55 // Sets the mode of the model based on |url|. | 50 // Sets the mode of the model based on |url|. |
56 void UpdateModel(const GURL& url); | 51 // |animate| is flag in model's mode. |
sky
2012/08/03 22:18:41
|animate| is set in the Mode passed to the model.
kuan
2012/08/13 20:19:46
Done.
| |
52 void UpdateModel(const GURL& url, bool animate); | |
57 | 53 |
58 // On navigation away from NTP and Search pages, delete |ntp_web_contents_|. | 54 // On navigation away from NTP and Search pages, delete |ntp_web_contents_|. |
59 void FlushNTP(const GURL& url); | 55 void FlushNTP(const GURL& url); |
60 | 56 |
61 const bool is_search_enabled_; | 57 const bool is_search_enabled_; |
62 | 58 |
63 // Model object for UI that cares about search state. | 59 // Model object for UI that cares about search state. |
64 SearchModel model_; | 60 SearchModel model_; |
65 | 61 |
66 // Lazily created web contents for NTP. | 62 // Lazily created web contents for NTP. |
67 scoped_ptr<content::WebContents> ntp_web_contents_; | 63 scoped_ptr<content::WebContents> ntp_web_contents_; |
68 | 64 |
65 // True if at least one navigation entry has been committed. | |
66 bool has_navigated_; | |
sky
2012/08/03 17:29:40
Can you query the navigation stack rather than mai
kuan
2012/08/03 17:46:49
Initially, when we would update mode in NavigateTo
kuan
2012/08/13 20:19:46
i've reverted to use NavigateToPendingEntry and Na
| |
67 | |
69 content::NotificationRegistrar registrar_; | 68 content::NotificationRegistrar registrar_; |
70 | 69 |
71 DISALLOW_COPY_AND_ASSIGN(SearchTabHelper); | 70 DISALLOW_COPY_AND_ASSIGN(SearchTabHelper); |
72 }; | 71 }; |
73 | 72 |
74 } // namespace search | 73 } // namespace search |
75 } // namespace chrome | 74 } // namespace chrome |
76 | 75 |
77 #endif // CHROME_BROWSER_UI_SEARCH_SEARCH_TAB_HELPER_H_ | 76 #endif // CHROME_BROWSER_UI_SEARCH_SEARCH_TAB_HELPER_H_ |
OLD | NEW |