| 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_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 <vector> |
| 9 |
| 8 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 9 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 10 #include "chrome/browser/ui/search/search_model.h" | 12 #include "chrome/browser/ui/search/search_model.h" |
| 13 #include "chrome/common/instant_types.h" |
| 11 #include "content/public/browser/notification_observer.h" | 14 #include "content/public/browser/notification_observer.h" |
| 12 #include "content/public/browser/notification_registrar.h" | 15 #include "content/public/browser/notification_registrar.h" |
| 13 #include "content/public/browser/web_contents_observer.h" | 16 #include "content/public/browser/web_contents_observer.h" |
| 14 #include "content/public/browser/web_contents_user_data.h" | 17 #include "content/public/browser/web_contents_user_data.h" |
| 15 | 18 |
| 16 namespace content { | 19 namespace content { |
| 17 class WebContents; | 20 class WebContents; |
| 18 } | 21 } |
| 19 | 22 |
| 20 // Per-tab search "helper". Acts as the owner and controller of the tab's | 23 // Per-tab search "helper". Acts as the owner and controller of the tab's |
| (...skipping 14 matching lines...) Expand all Loading... |
| 35 bool cancelling, | 38 bool cancelling, |
| 36 bool popup_is_open, | 39 bool popup_is_open, |
| 37 bool user_text_is_empty); | 40 bool user_text_is_empty); |
| 38 | 41 |
| 39 // Invoked when the active navigation entry is updated in some way that might | 42 // Invoked when the active navigation entry is updated in some way that might |
| 40 // affect the search mode. This is used by Instant when it "fixes up" the | 43 // affect the search mode. This is used by Instant when it "fixes up" the |
| 41 // virtual URL of the active entry. Regular navigations are captured through | 44 // virtual URL of the active entry. Regular navigations are captured through |
| 42 // the notification system and shouldn't call this method. | 45 // the notification system and shouldn't call this method. |
| 43 void NavigationEntryUpdated(); | 46 void NavigationEntryUpdated(); |
| 44 | 47 |
| 48 // Updates |last_known_most_visited_items_| with |items|. |
| 49 // Returns false if |items| matches the |last_known_most_visited_items_|. |
| 50 bool UpdateLastKnownMostVisitedItems( |
| 51 const std::vector<InstantMostVisitedItem>& items); |
| 52 |
| 45 private: | 53 private: |
| 46 friend class content::WebContentsUserData<SearchTabHelper>; | 54 friend class content::WebContentsUserData<SearchTabHelper>; |
| 47 | 55 |
| 48 explicit SearchTabHelper(content::WebContents* web_contents); | 56 explicit SearchTabHelper(content::WebContents* web_contents); |
| 49 | 57 |
| 50 // Overridden from content::NotificationObserver: | 58 // Overridden from content::NotificationObserver: |
| 51 virtual void Observe(int type, | 59 virtual void Observe(int type, |
| 52 const content::NotificationSource& source, | 60 const content::NotificationSource& source, |
| 53 const content::NotificationDetails& details) OVERRIDE; | 61 const content::NotificationDetails& details) OVERRIDE; |
| 54 | 62 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 70 bool popup_is_open_; | 78 bool popup_is_open_; |
| 71 bool user_text_is_empty_; | 79 bool user_text_is_empty_; |
| 72 | 80 |
| 73 // Model object for UI that cares about search state. | 81 // Model object for UI that cares about search state. |
| 74 SearchModel model_; | 82 SearchModel model_; |
| 75 | 83 |
| 76 content::NotificationRegistrar registrar_; | 84 content::NotificationRegistrar registrar_; |
| 77 | 85 |
| 78 content::WebContents* web_contents_; | 86 content::WebContents* web_contents_; |
| 79 | 87 |
| 88 // Tracks the last set of most visited items sent to the InstantPage renderer. |
| 89 // Used to prevent sending duplicate IPC messages to the renderer. |
| 90 std::vector<InstantMostVisitedItem> last_known_most_visited_items_; |
| 91 |
| 80 DISALLOW_COPY_AND_ASSIGN(SearchTabHelper); | 92 DISALLOW_COPY_AND_ASSIGN(SearchTabHelper); |
| 81 }; | 93 }; |
| 82 | 94 |
| 83 #endif // CHROME_BROWSER_UI_SEARCH_SEARCH_TAB_HELPER_H_ | 95 #endif // CHROME_BROWSER_UI_SEARCH_SEARCH_TAB_HELPER_H_ |
| OLD | NEW |