| 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" |
| 11 #include "base/string16.h" | 11 #include "base/string16.h" |
| 12 #include "chrome/common/instant_types.h" | 12 #include "chrome/common/instant_types.h" |
| 13 #include "chrome/common/search_types.h" | 13 #include "chrome/common/search_types.h" |
| 14 #include "content/public/common/page_transition_types.h" | 14 #include "content/public/common/page_transition_types.h" |
| 15 #include "content/public/renderer/render_view_observer.h" | 15 #include "content/public/renderer/render_view_observer.h" |
| 16 #include "content/public/renderer/render_view_observer_tracker.h" | 16 #include "content/public/renderer/render_view_observer_tracker.h" |
| 17 #include "ui/base/window_open_disposition.h" |
| 17 #include "ui/gfx/rect.h" | 18 #include "ui/gfx/rect.h" |
| 18 | 19 |
| 19 namespace content { | 20 namespace content { |
| 20 class RenderView; | 21 class RenderView; |
| 21 } | 22 } |
| 22 | 23 |
| 23 class SearchBox : public content::RenderViewObserver, | 24 class SearchBox : public content::RenderViewObserver, |
| 24 public content::RenderViewObserverTracker<SearchBox> { | 25 public content::RenderViewObserverTracker<SearchBox> { |
| 25 public: | 26 public: |
| 26 explicit SearchBox(content::RenderView* render_view); | 27 explicit SearchBox(content::RenderView* render_view); |
| 27 virtual ~SearchBox(); | 28 virtual ~SearchBox(); |
| 28 | 29 |
| 29 // Sends ChromeViewHostMsg_SetSuggestions to the browser. | 30 // Sends ChromeViewHostMsg_SetSuggestions to the browser. |
| 30 void SetSuggestions(const std::vector<InstantSuggestion>& suggestions); | 31 void SetSuggestions(const std::vector<InstantSuggestion>& suggestions); |
| 31 | 32 |
| 32 // Sends ChromeViewHostMsg_ShowInstantOverlay to the browser. | 33 // Sends ChromeViewHostMsg_ShowInstantOverlay to the browser. |
| 33 void ShowInstantOverlay(InstantShownReason reason, | 34 void ShowInstantOverlay(InstantShownReason reason, |
| 34 int height, | 35 int height, |
| 35 InstantSizeUnits units); | 36 InstantSizeUnits units); |
| 36 | 37 |
| 37 // Sends ChromeViewHostMsg_StartCapturingKeyStrokes to the browser. | 38 // Sends ChromeViewHostMsg_StartCapturingKeyStrokes to the browser. |
| 38 void StartCapturingKeyStrokes(); | 39 void StartCapturingKeyStrokes(); |
| 39 | 40 |
| 40 // Sends ChromeViewHostMsg_StopCapturingKeyStrokes to the browser. | 41 // Sends ChromeViewHostMsg_StopCapturingKeyStrokes to the browser. |
| 41 void StopCapturingKeyStrokes(); | 42 void StopCapturingKeyStrokes(); |
| 42 | 43 |
| 43 // Sends ChromeViewHostMsg_SearchBoxNavigate to the browser. | 44 // Sends ChromeViewHostMsg_SearchBoxNavigate to the browser. |
| 44 void NavigateToURL(const GURL& url, content::PageTransition transition); | 45 void NavigateToURL(const GURL& url, |
| 46 content::PageTransition transition, |
| 47 WindowOpenDisposition disposition); |
| 45 | 48 |
| 46 // Sends ChromeViewHostMsg_InstantDeleteMostVisitedItem to the browser. | 49 // Sends ChromeViewHostMsg_InstantDeleteMostVisitedItem to the browser. |
| 47 void DeleteMostVisitedItem(int restrict_id); | 50 void DeleteMostVisitedItem(int restrict_id); |
| 48 | 51 |
| 49 // Sends ChromeViewHostMsg_InstantUndoMostVisitedDeletion to the browser. | 52 // Sends ChromeViewHostMsg_InstantUndoMostVisitedDeletion to the browser. |
| 50 void UndoMostVisitedDeletion(int restrict_id); | 53 void UndoMostVisitedDeletion(int restrict_id); |
| 51 | 54 |
| 52 // Sends ChromeViewHostMsg_InstantUndoAllMostVisitedDeletions to the browser. | 55 // Sends ChromeViewHostMsg_InstantUndoAllMostVisitedDeletions to the browser. |
| 53 void UndoAllMostVisitedDeletions(); | 56 void UndoAllMostVisitedDeletions(); |
| 54 | 57 |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 // TODO(dcblack): Unify this logic to work with both Most Visited and | 142 // TODO(dcblack): Unify this logic to work with both Most Visited and |
| 140 // history suggestions. (crbug/175768) | 143 // history suggestions. (crbug/175768) |
| 141 std::map<string16, int> url_to_restricted_id_map_; | 144 std::map<string16, int> url_to_restricted_id_map_; |
| 142 std::map<int, string16> restricted_id_to_url_map_; | 145 std::map<int, string16> restricted_id_to_url_map_; |
| 143 int last_restricted_id_; | 146 int last_restricted_id_; |
| 144 | 147 |
| 145 DISALLOW_COPY_AND_ASSIGN(SearchBox); | 148 DISALLOW_COPY_AND_ASSIGN(SearchBox); |
| 146 }; | 149 }; |
| 147 | 150 |
| 148 #endif // CHROME_RENDERER_SEARCHBOX_SEARCHBOX_H_ | 151 #endif // CHROME_RENDERER_SEARCHBOX_SEARCHBOX_H_ |
| OLD | NEW |