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