OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_ENGINES_SEARCH_ENGINE_TAB_HELPER_H_ | 5 #ifndef CHROME_BROWSER_UI_SEARCH_ENGINES_SEARCH_ENGINE_TAB_HELPER_H_ |
6 #define CHROME_BROWSER_UI_SEARCH_ENGINES_SEARCH_ENGINE_TAB_HELPER_H_ | 6 #define CHROME_BROWSER_UI_SEARCH_ENGINES_SEARCH_ENGINE_TAB_HELPER_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/memory/weak_ptr.h" | |
10 #include "chrome/browser/ui/find_bar/find_bar_controller.h" | 9 #include "chrome/browser/ui/find_bar/find_bar_controller.h" |
11 #include "chrome/browser/ui/find_bar/find_notification_details.h" | 10 #include "chrome/browser/ui/find_bar/find_notification_details.h" |
| 11 #include "chrome/common/open_search_description_document_handler.mojom.h" |
| 12 #include "content/public/browser/web_contents_binding_set.h" |
12 #include "content/public/browser/web_contents_observer.h" | 13 #include "content/public/browser/web_contents_observer.h" |
13 #include "content/public/browser/web_contents_user_data.h" | 14 #include "content/public/browser/web_contents_user_data.h" |
14 | 15 |
15 // Per-tab search engine manager. Handles dealing search engine processing | 16 // Per-tab search engine manager. Handles dealing search engine processing |
16 // functionality. | 17 // functionality. |
17 class SearchEngineTabHelper | 18 class SearchEngineTabHelper |
18 : public content::WebContentsObserver, | 19 : public content::WebContentsObserver, |
19 public content::WebContentsUserData<SearchEngineTabHelper> { | 20 public content::WebContentsUserData<SearchEngineTabHelper>, |
| 21 public chrome::mojom::OpenSearchDescriptionDocumentHandler { |
20 public: | 22 public: |
21 ~SearchEngineTabHelper() override; | 23 ~SearchEngineTabHelper() override; |
22 | 24 |
23 // content::WebContentsObserver overrides. | 25 // content::WebContentsObserver overrides. |
24 void DidFinishNavigation(content::NavigationHandle* handle) override; | 26 void DidFinishNavigation(content::NavigationHandle* handle) override; |
25 | 27 |
26 bool OnMessageReceived(const IPC::Message& message) override; | |
27 bool OnMessageReceived(const IPC::Message& message, | |
28 content::RenderFrameHost* rfh) override; | |
29 | |
30 private: | 28 private: |
31 explicit SearchEngineTabHelper(content::WebContents* web_contents); | 29 explicit SearchEngineTabHelper(content::WebContents* web_contents); |
32 friend class content::WebContentsUserData<SearchEngineTabHelper>; | 30 friend class content::WebContentsUserData<SearchEngineTabHelper>; |
33 | 31 |
34 // Handles when a page specifies an OSDD (OpenSearch Description Document). | 32 // chrome::mojom::OpenSearchDescriptionDocumentHandler overrides. |
35 void OnPageHasOSDD(const GURL& page_url, const GURL& osdd_url); | 33 void PageHasOpenSearchDescriptionDocument(const GURL& page_url, |
| 34 const GURL& osdd_url) override; |
36 | 35 |
37 // If params has a searchable form, this tries to create a new keyword. | 36 // If params has a searchable form, this tries to create a new keyword. |
38 void GenerateKeywordIfNecessary(content::NavigationHandle* handle); | 37 void GenerateKeywordIfNecessary(content::NavigationHandle* handle); |
39 | 38 |
| 39 content::WebContentsFrameBindingSet< |
| 40 chrome::mojom::OpenSearchDescriptionDocumentHandler> |
| 41 osdd_handler_bindings_; |
| 42 |
40 DISALLOW_COPY_AND_ASSIGN(SearchEngineTabHelper); | 43 DISALLOW_COPY_AND_ASSIGN(SearchEngineTabHelper); |
41 }; | 44 }; |
42 | 45 |
43 #endif // CHROME_BROWSER_UI_SEARCH_ENGINES_SEARCH_ENGINE_TAB_HELPER_H_ | 46 #endif // CHROME_BROWSER_UI_SEARCH_ENGINES_SEARCH_ENGINE_TAB_HELPER_H_ |
OLD | NEW |