| 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_RENDERER_SEARCHBOX_SEARCHBOX_H_ |    5 #ifndef CHROME_RENDERER_SEARCHBOX_SEARCHBOX_H_ | 
|    6 #define CHROME_RENDERER_SEARCHBOX_SEARCHBOX_H_ |    6 #define CHROME_RENDERER_SEARCHBOX_SEARCHBOX_H_ | 
|    7  |    7  | 
|    8 #include <vector> |    8 #include <vector> | 
|    9  |    9  | 
|   10 #include "base/basictypes.h" |   10 #include "base/basictypes.h" | 
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   42   void StartCapturingKeyStrokes(); |   42   void StartCapturingKeyStrokes(); | 
|   43  |   43  | 
|   44   // Sends ChromeViewHostMsg_StopCapturingKeyStrokes to the browser. |   44   // Sends ChromeViewHostMsg_StopCapturingKeyStrokes to the browser. | 
|   45   void StopCapturingKeyStrokes(); |   45   void StopCapturingKeyStrokes(); | 
|   46  |   46  | 
|   47   // Sends ChromeViewHostMsg_SearchBoxNavigate to the browser. |   47   // Sends ChromeViewHostMsg_SearchBoxNavigate to the browser. | 
|   48   void NavigateToURL(const GURL& url, |   48   void NavigateToURL(const GURL& url, | 
|   49                      content::PageTransition transition, |   49                      content::PageTransition transition, | 
|   50                      WindowOpenDisposition disposition); |   50                      WindowOpenDisposition disposition); | 
|   51  |   51  | 
|   52   // Sends ChromeViewHostMsg_InstantDeleteMostVisitedItem to the browser. |   52   // Sends ChromeViewHostMsg_SearchBoxDeleteMostVisitedItem to the browser. | 
|   53   void DeleteMostVisitedItem(int most_visited_item_id); |   53   void DeleteMostVisitedItem(uint64 most_visited_item_id); | 
|   54  |   54  | 
|   55   // Sends ChromeViewHostMsg_InstantUndoMostVisitedDeletion to the browser. |   55   // Sends ChromeViewHostMsg_SearchBoxUndoMostVisitedDeletion to the browser. | 
|   56   void UndoMostVisitedDeletion(int most_visited_item_id); |   56   void UndoMostVisitedDeletion(uint64 most_visited_item_id); | 
|   57  |   57  | 
|   58   // Sends ChromeViewHostMsg_InstantUndoAllMostVisitedDeletions to the browser. |   58   // Sends ChromeViewHostMsg_SearchBoxUndoAllMostVisitedDeletions to the | 
 |   59   // browser. | 
|   59   void UndoAllMostVisitedDeletions(); |   60   void UndoAllMostVisitedDeletions(); | 
|   60  |   61  | 
|   61   const string16& query() const { return query_; } |   62   const string16& query() const { return query_; } | 
|   62   bool verbatim() const { return verbatim_; } |   63   bool verbatim() const { return verbatim_; } | 
|   63   size_t selection_start() const { return selection_start_; } |   64   size_t selection_start() const { return selection_start_; } | 
|   64   size_t selection_end() const { return selection_end_; } |   65   size_t selection_end() const { return selection_end_; } | 
|   65   int results_base() const { return results_base_; } |   66   int results_base() const { return results_base_; } | 
|   66   bool is_key_capture_enabled() const { return is_key_capture_enabled_; } |   67   bool is_key_capture_enabled() const { return is_key_capture_enabled_; } | 
|   67   bool display_instant_results() const { return display_instant_results_; } |   68   bool display_instant_results() const { return display_instant_results_; } | 
|   68   const string16& omnibox_font() const { return omnibox_font_; } |   69   const string16& omnibox_font() const { return omnibox_font_; } | 
|   69   size_t omnibox_font_size() const { return omnibox_font_size_; } |   70   size_t omnibox_font_size() const { return omnibox_font_size_; } | 
|   70  |   71  | 
|   71   // In extended Instant, returns the start-edge margin of the location bar in |   72   // In extended Instant, returns the start-edge margin of the location bar in | 
|   72   // screen pixels. |   73   // screen pixels. | 
|   73   int GetStartMargin() const; |   74   int GetStartMargin() const; | 
|   74  |   75  | 
|   75   // Returns the bounds of the omnibox popup in screen coordinates. |   76   // Returns the bounds of the omnibox popup in screen coordinates. | 
|   76   gfx::Rect GetPopupBounds() const; |   77   gfx::Rect GetPopupBounds() const; | 
|   77  |   78  | 
|   78   const std::vector<InstantAutocompleteResult>& GetAutocompleteResults(); |   79   const std::vector<InstantAutocompleteResult>& GetAutocompleteResults(); | 
|   79   // Searchbox retains ownership of this object. |   80   // Searchbox retains ownership of this object. | 
|   80   const InstantAutocompleteResult* |   81   const InstantAutocompleteResult* | 
|   81       GetAutocompleteResultWithId(size_t autocomplete_result_id) const; |   82       GetAutocompleteResultWithId(size_t autocomplete_result_id) const; | 
|   82   const ThemeBackgroundInfo& GetThemeBackgroundInfo(); |   83   const ThemeBackgroundInfo& GetThemeBackgroundInfo(); | 
|   83  |   84  | 
|   84   // Most Visited items. |   85   // Most Visited items. | 
|   85   const std::vector<MostVisitedItem>& GetMostVisitedItems(); |   86   const std::vector<InstantMostVisitedItem>& GetMostVisitedItems() const; | 
|   86  |  | 
|   87   // Secure Urls. |  | 
|   88   int URLToMostVisitedItemID(const string16 url); |  | 
|   89   string16 MostVisitedItemIDToURL(int most_visited_item_id); |  | 
|   90   string16 GenerateThumbnailUrl(int most_visited_item_id); |  | 
|   91   string16 GenerateFaviconUrl(int most_visited_item_id); |  | 
|   92  |   87  | 
|   93  private: |   88  private: | 
|   94   // Overridden from content::RenderViewObserver: |   89   // Overridden from content::RenderViewObserver: | 
|   95   virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |   90   virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 
|   96   virtual void DidClearWindowObject(WebKit::WebFrame* frame) OVERRIDE; |   91   virtual void DidClearWindowObject(WebKit::WebFrame* frame) OVERRIDE; | 
|   97  |   92  | 
|   98   void OnChange(const string16& query, |   93   void OnChange(const string16& query, | 
|   99                 bool verbatim, |   94                 bool verbatim, | 
|  100                 size_t selection_start, |   95                 size_t selection_start, | 
|  101                 size_t selection_end); |   96                 size_t selection_end); | 
|  102   void OnSubmit(const string16& query); |   97   void OnSubmit(const string16& query); | 
|  103   void OnCancel(const string16& query); |   98   void OnCancel(const string16& query); | 
|  104   void OnPopupResize(const gfx::Rect& bounds); |   99   void OnPopupResize(const gfx::Rect& bounds); | 
|  105   void OnMarginChange(int margin, int width); |  100   void OnMarginChange(int margin, int width); | 
|  106   void OnDetermineIfPageSupportsInstant(); |  101   void OnDetermineIfPageSupportsInstant(); | 
|  107   void OnAutocompleteResults( |  102   void OnAutocompleteResults( | 
|  108       const std::vector<InstantAutocompleteResult>& results); |  103       const std::vector<InstantAutocompleteResult>& results); | 
|  109   void OnUpOrDownKeyPressed(int count); |  104   void OnUpOrDownKeyPressed(int count); | 
|  110   void OnCancelSelection(const string16& query); |  105   void OnCancelSelection(const string16& query); | 
|  111   void OnKeyCaptureChange(bool is_key_capture_enabled); |  106   void OnKeyCaptureChange(bool is_key_capture_enabled); | 
|  112   void OnSetDisplayInstantResults(bool display_instant_results); |  107   void OnSetDisplayInstantResults(bool display_instant_results); | 
|  113   void OnThemeChanged(const ThemeBackgroundInfo& theme_info); |  108   void OnThemeChanged(const ThemeBackgroundInfo& theme_info); | 
|  114   void OnThemeAreaHeightChanged(int height); |  109   void OnThemeAreaHeightChanged(int height); | 
|  115   void OnFontInformationReceived(const string16& omnibox_font, |  110   void OnFontInformationReceived(const string16& omnibox_font, | 
|  116                                  size_t omnibox_font_size); |  111                                  size_t omnibox_font_size); | 
|  117   void OnGrantChromeSearchAccessFromOrigin(const GURL& origin_url); |  112   void OnGrantChromeSearchAccessFromOrigin(const GURL& origin_url); | 
|  118   void OnMostVisitedChanged(const std::vector<MostVisitedItem>& items); |  113   void OnMostVisitedChanged(const std::vector<InstantMostVisitedItem>& items); | 
|  119  |  114  | 
|  120   // Returns the current zoom factor of the render view or 1 on failure. |  115   // Returns the current zoom factor of the render view or 1 on failure. | 
|  121   double GetZoom() const; |  116   double GetZoom() const; | 
|  122  |  117  | 
|  123   // Sets the searchbox values to their initial value. |  118   // Sets the searchbox values to their initial value. | 
|  124   void Reset(); |  119   void Reset(); | 
|  125  |  120  | 
|  126   string16 query_; |  121   string16 query_; | 
|  127   bool verbatim_; |  122   bool verbatim_; | 
|  128   size_t selection_start_; |  123   size_t selection_start_; | 
|  129   size_t selection_end_; |  124   size_t selection_end_; | 
|  130   size_t results_base_; |  125   size_t results_base_; | 
|  131   int start_margin_; |  126   int start_margin_; | 
|  132   gfx::Rect popup_bounds_; |  127   gfx::Rect popup_bounds_; | 
|  133   std::vector<InstantAutocompleteResult> autocomplete_results_; |  128   std::vector<InstantAutocompleteResult> autocomplete_results_; | 
|  134   size_t last_results_base_; |  129   size_t last_results_base_; | 
|  135   std::vector<InstantAutocompleteResult> last_autocomplete_results_; |  130   std::vector<InstantAutocompleteResult> last_autocomplete_results_; | 
|  136   bool is_key_capture_enabled_; |  131   bool is_key_capture_enabled_; | 
|  137   ThemeBackgroundInfo theme_info_; |  132   ThemeBackgroundInfo theme_info_; | 
|  138   bool display_instant_results_; |  133   bool display_instant_results_; | 
|  139   string16 omnibox_font_; |  134   string16 omnibox_font_; | 
|  140   size_t omnibox_font_size_; |  135   size_t omnibox_font_size_; | 
|  141   std::vector<MostVisitedItem> most_visited_items_; |  136   std::vector<InstantMostVisitedItem> most_visited_items_; | 
|  142  |  | 
|  143   // TODO(dcblack): Unify this logic to work with both Most Visited and |  | 
|  144   // history suggestions. http://crbug.com/175768 |  | 
|  145   std::map<string16, int> url_to_most_visited_item_id_map_; |  | 
|  146   std::map<int, string16> most_visited_item_id_to_url_map_; |  | 
|  147   int last_most_visited_item_id_; |  | 
|  148  |  137  | 
|  149   DISALLOW_COPY_AND_ASSIGN(SearchBox); |  138   DISALLOW_COPY_AND_ASSIGN(SearchBox); | 
|  150 }; |  139 }; | 
|  151  |  140  | 
|  152 #endif  // CHROME_RENDERER_SEARCHBOX_SEARCHBOX_H_ |  141 #endif  // CHROME_RENDERER_SEARCHBOX_SEARCHBOX_H_ | 
| OLD | NEW |