| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_PAGE_H_ | 5 #ifndef CHROME_BROWSER_UI_SEARCH_INSTANT_PAGE_H_ |
| 6 #define CHROME_BROWSER_UI_SEARCH_INSTANT_PAGE_H_ | 6 #define CHROME_BROWSER_UI_SEARCH_INSTANT_PAGE_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/string16.h" | 12 #include "base/string16.h" |
| 13 #include "chrome/common/instant_types.h" | 13 #include "chrome/common/instant_types.h" |
| 14 #include "chrome/common/omnibox_focus_state.h" |
| 14 #include "content/public/browser/web_contents_observer.h" | 15 #include "content/public/browser/web_contents_observer.h" |
| 15 #include "content/public/common/page_transition_types.h" | 16 #include "content/public/common/page_transition_types.h" |
| 16 | 17 |
| 17 class GURL; | 18 class GURL; |
| 18 | 19 |
| 19 namespace content { | 20 namespace content { |
| 20 class WebContents; | 21 class WebContents; |
| 21 } | 22 } |
| 22 | 23 |
| 23 namespace gfx { | 24 namespace gfx { |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 virtual void SetSuggestions( | 59 virtual void SetSuggestions( |
| 59 const content::WebContents* contents, | 60 const content::WebContents* contents, |
| 60 const std::vector<InstantSuggestion>& suggestions) = 0; | 61 const std::vector<InstantSuggestion>& suggestions) = 0; |
| 61 | 62 |
| 62 // Called when the page wants to be shown. Usually in response to Update() | 63 // Called when the page wants to be shown. Usually in response to Update() |
| 63 // or SendAutocompleteResults(). | 64 // or SendAutocompleteResults(). |
| 64 virtual void ShowInstantOverlay(const content::WebContents* contents, | 65 virtual void ShowInstantOverlay(const content::WebContents* contents, |
| 65 int height, | 66 int height, |
| 66 InstantSizeUnits units) = 0; | 67 InstantSizeUnits units) = 0; |
| 67 | 68 |
| 68 // Called when the page wants the omnibox to be focused. | 69 // Called when the page wants the omnibox to be focused. |state| specifies |
| 69 virtual void FocusOmnibox(const content::WebContents* contents) = 0; | 70 // the omnibox focus state. |
| 70 | 71 virtual void FocusOmnibox(const content::WebContents* contents, |
| 71 // Called when the page wants the omnibox to start capturing user key | 72 OmniboxFocusState state) = 0; |
| 72 // strokes. If this call is processed successfully, the omnibox will not | |
| 73 // look focused visibly but any user key strokes will go to the omnibox. | |
| 74 // Currently, this is implemented by focusing the omnibox invisibly. | |
| 75 virtual void StartCapturingKeyStrokes( | |
| 76 const content::WebContents* contents) = 0; | |
| 77 | |
| 78 // Called when the page wants the omnibox to stop capturing user key | |
| 79 // strokes. | |
| 80 virtual void StopCapturingKeyStrokes(content::WebContents* contents) = 0; | |
| 81 | 73 |
| 82 // Called when the page wants to navigate to |url|. Usually used by the | 74 // Called when the page wants to navigate to |url|. Usually used by the |
| 83 // page to navigate to privileged destinations (e.g. chrome:// URLs) or to | 75 // page to navigate to privileged destinations (e.g. chrome:// URLs) or to |
| 84 // navigate to URLs that are hidden from the page using Restricted IDs (rid | 76 // navigate to URLs that are hidden from the page using Restricted IDs (rid |
| 85 // in the API). | 77 // in the API). |
| 86 virtual void NavigateToURL(const content::WebContents* contents, | 78 virtual void NavigateToURL(const content::WebContents* contents, |
| 87 const GURL& url, | 79 const GURL& url, |
| 88 content::PageTransition transition, | 80 content::PageTransition transition, |
| 89 WindowOpenDisposition disposition) = 0; | 81 WindowOpenDisposition disposition) = 0; |
| 90 | 82 |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 // These functions are called before processing messages received from the | 189 // These functions are called before processing messages received from the |
| 198 // page. By default, all messages are handled, but any derived classes may | 190 // page. By default, all messages are handled, but any derived classes may |
| 199 // choose to ingore some or all of the received messages by overriding these | 191 // choose to ingore some or all of the received messages by overriding these |
| 200 // methods. | 192 // methods. |
| 201 virtual bool ShouldProcessRenderViewCreated(); | 193 virtual bool ShouldProcessRenderViewCreated(); |
| 202 virtual bool ShouldProcessRenderViewGone(); | 194 virtual bool ShouldProcessRenderViewGone(); |
| 203 virtual bool ShouldProcessAboutToNavigateMainFrame(); | 195 virtual bool ShouldProcessAboutToNavigateMainFrame(); |
| 204 virtual bool ShouldProcessSetSuggestions(); | 196 virtual bool ShouldProcessSetSuggestions(); |
| 205 virtual bool ShouldProcessShowInstantOverlay(); | 197 virtual bool ShouldProcessShowInstantOverlay(); |
| 206 virtual bool ShouldProcessFocusOmnibox(); | 198 virtual bool ShouldProcessFocusOmnibox(); |
| 207 virtual bool ShouldProcessStartCapturingKeyStrokes(); | |
| 208 virtual bool ShouldProcessStopCapturingKeyStrokes(); | |
| 209 virtual bool ShouldProcessNavigateToURL(); | 199 virtual bool ShouldProcessNavigateToURL(); |
| 210 | 200 |
| 211 private: | 201 private: |
| 212 // Overridden from content::WebContentsObserver: | 202 // Overridden from content::WebContentsObserver: |
| 213 virtual void RenderViewCreated( | 203 virtual void RenderViewCreated( |
| 214 content::RenderViewHost* render_view_host) OVERRIDE; | 204 content::RenderViewHost* render_view_host) OVERRIDE; |
| 215 virtual void DidFinishLoad( | 205 virtual void DidFinishLoad( |
| 216 int64 frame_id, | 206 int64 frame_id, |
| 217 const GURL& validated_url, | 207 const GURL& validated_url, |
| 218 bool is_main_frame, | 208 bool is_main_frame, |
| 219 content::RenderViewHost* render_view_host) OVERRIDE; | 209 content::RenderViewHost* render_view_host) OVERRIDE; |
| 220 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 210 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 221 virtual void RenderViewGone(base::TerminationStatus status) OVERRIDE; | 211 virtual void RenderViewGone(base::TerminationStatus status) OVERRIDE; |
| 222 virtual void DidCommitProvisionalLoadForFrame( | 212 virtual void DidCommitProvisionalLoadForFrame( |
| 223 int64 frame_id, | 213 int64 frame_id, |
| 224 bool is_main_frame, | 214 bool is_main_frame, |
| 225 const GURL& url, | 215 const GURL& url, |
| 226 content::PageTransition transition_type, | 216 content::PageTransition transition_type, |
| 227 content::RenderViewHost* render_view_host) OVERRIDE; | 217 content::RenderViewHost* render_view_host) OVERRIDE; |
| 228 | 218 |
| 229 void OnSetSuggestions(int page_id, | 219 void OnSetSuggestions(int page_id, |
| 230 const std::vector<InstantSuggestion>& suggestions); | 220 const std::vector<InstantSuggestion>& suggestions); |
| 231 void OnInstantSupportDetermined(int page_id, bool supports_instant); | 221 void OnInstantSupportDetermined(int page_id, bool supports_instant); |
| 232 void OnShowInstantOverlay(int page_id, | 222 void OnShowInstantOverlay(int page_id, |
| 233 int height, | 223 int height, |
| 234 InstantSizeUnits units); | 224 InstantSizeUnits units); |
| 235 void OnFocusOmnibox(int page_id); | 225 void OnFocusOmnibox(int page_id, OmniboxFocusState state); |
| 236 void OnStartCapturingKeyStrokes(int page_id); | |
| 237 void OnStopCapturingKeyStrokes(int page_id); | |
| 238 void OnSearchBoxNavigate(int page_id, | 226 void OnSearchBoxNavigate(int page_id, |
| 239 const GURL& url, | 227 const GURL& url, |
| 240 content::PageTransition transition, | 228 content::PageTransition transition, |
| 241 WindowOpenDisposition disposition); | 229 WindowOpenDisposition disposition); |
| 242 void OnDeleteMostVisitedItem(InstantRestrictedID most_visited_item_id); | 230 void OnDeleteMostVisitedItem(InstantRestrictedID most_visited_item_id); |
| 243 void OnUndoMostVisitedDeletion(InstantRestrictedID most_visited_item_id); | 231 void OnUndoMostVisitedDeletion(InstantRestrictedID most_visited_item_id); |
| 244 void OnUndoAllMostVisitedDeletions(); | 232 void OnUndoAllMostVisitedDeletions(); |
| 245 | 233 |
| 246 Delegate* const delegate_; | 234 Delegate* const delegate_; |
| 247 bool supports_instant_; | 235 bool supports_instant_; |
| 248 | 236 |
| 249 DISALLOW_COPY_AND_ASSIGN(InstantPage); | 237 DISALLOW_COPY_AND_ASSIGN(InstantPage); |
| 250 }; | 238 }; |
| 251 | 239 |
| 252 #endif // CHROME_BROWSER_UI_SEARCH_INSTANT_PAGE_H_ | 240 #endif // CHROME_BROWSER_UI_SEARCH_INSTANT_PAGE_H_ |
| OLD | NEW |