Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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_INSTANT_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_UI_SEARCH_INSTANT_CONTROLLER_H_ |
| 6 #define CHROME_BROWSER_UI_SEARCH_INSTANT_CONTROLLER_H_ | 6 #define CHROME_BROWSER_UI_SEARCH_INSTANT_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <list> | 10 #include <list> |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 50 | 50 |
| 51 // The search mode in the active tab has changed. Bind |instant_tab_| if the | 51 // The search mode in the active tab has changed. Bind |instant_tab_| if the |
| 52 // |new_mode| reflects an Instant search results page. | 52 // |new_mode| reflects an Instant search results page. |
| 53 void SearchModeChanged(const SearchMode& old_mode, | 53 void SearchModeChanged(const SearchMode& old_mode, |
| 54 const SearchMode& new_mode); | 54 const SearchMode& new_mode); |
| 55 | 55 |
| 56 // The user switched tabs. Bind |instant_tab_| if the newly active tab is an | 56 // The user switched tabs. Bind |instant_tab_| if the newly active tab is an |
| 57 // Instant search results page. | 57 // Instant search results page. |
| 58 void ActiveTabChanged(); | 58 void ActiveTabChanged(); |
| 59 | 59 |
| 60 // Adds a new event to |debug_events_| and also DVLOG's it. Ensures that | 60 // Used by BrowserInstantController to notify InstantController about the |
| 61 // |debug_events_| doesn't get too large. | 61 // instant support change event for the active web contents. |
| 62 void LogDebugEvent(const std::string& info) const; | 62 void InstantSupportChanged(InstantSupportState instant_support); |
|
Marc Treib
2016/07/21 16:40:09
Made private
| |
| 63 | 63 |
| 64 // Resets list of debug events. | 64 // Resets list of debug events. |
| 65 void ClearDebugEvents(); | 65 void ClearDebugEvents(); |
| 66 | 66 |
| 67 // See comments for |debug_events_| below. | 67 // See comments for |debug_events_| below. |
| 68 const std::list<std::pair<int64_t, std::string>>& debug_events() { | 68 const std::list<std::pair<int64_t, std::string>>& debug_events() { |
| 69 return debug_events_; | 69 return debug_events_; |
| 70 } | 70 } |
| 71 | 71 |
| 72 // Used by BrowserInstantController to notify InstantController about the | |
| 73 // instant support change event for the active web contents. | |
| 74 void InstantSupportChanged(InstantSupportState instant_support); | |
|
Marc Treib
2016/07/21 16:40:09
Moved up, above the debug stuff
| |
| 75 | |
| 76 protected: | |
| 77 // Accessors are made protected for testing purposes. | |
| 78 virtual InstantTab* instant_tab() const; | |
| 79 | |
| 80 virtual Profile* profile() const; | |
|
Marc Treib
2016/07/21 16:40:09
Neither of these are needed
| |
| 81 | |
| 82 private: | 72 private: |
| 83 friend class InstantExtendedManualTest; | 73 friend class InstantExtendedManualTest; |
| 84 friend class InstantTestBase; | 74 friend class InstantTestBase; |
| 85 | 75 |
| 86 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, ExtendedModeIsOn); | 76 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, ExtendedModeIsOn); |
| 87 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, MostVisited); | 77 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, MostVisited); |
| 88 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, ProcessIsolation); | 78 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, ProcessIsolation); |
| 89 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, UnrelatedSiteInstance); | 79 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, UnrelatedSiteInstance); |
| 90 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, OnDefaultSearchProviderChanged); | 80 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, OnDefaultSearchProviderChanged); |
| 91 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, | 81 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 104 DispatchMVChangeEventWhileNavigatingBackToNTP); | 94 DispatchMVChangeEventWhileNavigatingBackToNTP); |
| 105 | 95 |
| 106 // Overridden from InstantTab::Delegate: | 96 // Overridden from InstantTab::Delegate: |
| 107 // TODO(shishir): We assume that the WebContent's current RenderViewHost is | 97 // TODO(shishir): We assume that the WebContent's current RenderViewHost is |
| 108 // the RenderViewHost being created which is not always true. Fix this. | 98 // the RenderViewHost being created which is not always true. Fix this. |
| 109 void InstantSupportDetermined(const content::WebContents* contents, | 99 void InstantSupportDetermined(const content::WebContents* contents, |
| 110 bool supports_instant) override; | 100 bool supports_instant) override; |
| 111 void InstantTabAboutToNavigateMainFrame(const content::WebContents* contents, | 101 void InstantTabAboutToNavigateMainFrame(const content::WebContents* contents, |
| 112 const GURL& url) override; | 102 const GURL& url) override; |
| 113 | 103 |
| 104 // Adds a new event to |debug_events_| and also DVLOG's it. Ensures that | |
| 105 // |debug_events_| doesn't get too large. | |
| 106 void LogDebugEvent(const std::string& info) const; | |
| 107 | |
| 114 // If the active tab is an Instant search results page, sets |instant_tab_| to | 108 // If the active tab is an Instant search results page, sets |instant_tab_| to |
| 115 // point to it. Else, deletes any existing |instant_tab_|. | 109 // point to it. Else, deletes any existing |instant_tab_|. |
| 116 void ResetInstantTab(); | 110 void ResetInstantTab(); |
| 117 | 111 |
| 118 // Sends theme info and most visited items to the Instant tab. | 112 // Sends theme info and most visited items to the Instant tab. |
| 119 void UpdateInfoForInstantTab(); | 113 void UpdateInfoForInstantTab(); |
| 120 | 114 |
| 121 // Returns the InstantService for the browser profile. | 115 // Returns the InstantService for the browser profile. |
| 122 InstantService* GetInstantService() const; | 116 InstantService* GetInstantService() const; |
| 123 | 117 |
| 124 BrowserInstantController* const browser_; | 118 BrowserInstantController* const browser_; |
| 125 | 119 |
| 126 // The instance of InstantTab maintained by InstantController. | 120 // The instance of InstantTab maintained by InstantController. |
| 127 std::unique_ptr<InstantTab> instant_tab_; | 121 std::unique_ptr<InstantTab> instant_tab_; |
| 128 | 122 |
| 129 // The search model mode for the active tab. | 123 // The search model mode for the active tab. |
| 130 SearchMode search_mode_; | 124 SearchMode search_mode_; |
| 131 | 125 |
| 132 // List of events and their timestamps, useful in debugging Instant behaviour. | 126 // List of events and their timestamps, useful in debugging Instant behaviour. |
| 133 mutable std::list<std::pair<int64_t, std::string>> debug_events_; | 127 mutable std::list<std::pair<int64_t, std::string>> debug_events_; |
| 134 | 128 |
| 135 DISALLOW_COPY_AND_ASSIGN(InstantController); | 129 DISALLOW_COPY_AND_ASSIGN(InstantController); |
| 136 }; | 130 }; |
| 137 | 131 |
| 138 #endif // CHROME_BROWSER_UI_SEARCH_INSTANT_CONTROLLER_H_ | 132 #endif // CHROME_BROWSER_UI_SEARCH_INSTANT_CONTROLLER_H_ |
| OLD | NEW |