Chromium Code Reviews| 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 "chrome/common/osdd_handler.mojom.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" |
| 15 #include "mojo/public/cpp/bindings/binding.h" | |
| 14 | 16 |
| 15 // Per-tab search engine manager. Handles dealing search engine processing | 17 // Per-tab search engine manager. Handles dealing search engine processing |
| 16 // functionality. | 18 // functionality. |
| 17 class SearchEngineTabHelper | 19 class SearchEngineTabHelper |
| 18 : public content::WebContentsObserver, | 20 : public content::WebContentsObserver, |
| 19 public content::WebContentsUserData<SearchEngineTabHelper> { | 21 public content::WebContentsUserData<SearchEngineTabHelper>, |
| 22 public chrome::mojom::OSDDHandler { | |
| 20 public: | 23 public: |
| 24 SearchEngineTabHelper(); | |
|
Sam McNally
2017/03/15 00:38:48
Is this necessary?
martis
2017/03/15 05:00:56
I believe so - I've introduced a non-default const
Sam McNally
2017/03/15 05:55:15
The non-default constructor was there before. I do
| |
| 21 ~SearchEngineTabHelper() override; | 25 ~SearchEngineTabHelper() override; |
| 22 | 26 |
| 23 // content::WebContentsObserver overrides. | 27 // content::WebContentsObserver overrides. |
| 28 void RenderFrameCreated(content::RenderFrameHost* render_frame_host) override; | |
| 24 void DidFinishNavigation(content::NavigationHandle* handle) override; | 29 void DidFinishNavigation(content::NavigationHandle* handle) override; |
| 25 | 30 |
| 26 bool OnMessageReceived(const IPC::Message& message) override; | |
| 27 bool OnMessageReceived(const IPC::Message& message, | |
| 28 content::RenderFrameHost* rfh) override; | |
| 29 | |
| 30 private: | 31 private: |
| 31 explicit SearchEngineTabHelper(content::WebContents* web_contents); | 32 explicit SearchEngineTabHelper(content::WebContents* web_contents); |
| 32 friend class content::WebContentsUserData<SearchEngineTabHelper>; | 33 friend class content::WebContentsUserData<SearchEngineTabHelper>; |
| 33 | 34 |
| 34 // Handles when a page specifies an OSDD (OpenSearch Description Document). | 35 // chrome::mojom::OSDDHandler overrides. |
| 35 void OnPageHasOSDD(const GURL& page_url, const GURL& osdd_url); | 36 void OnPageHasOSDD(const GURL& page_url, const GURL& osdd_url) override; |
| 37 | |
| 38 // Binds the given request to this object. | |
| 39 void OnOSDDHandlerRequest(chrome::mojom::OSDDHandlerRequest request); | |
| 36 | 40 |
| 37 // If params has a searchable form, this tries to create a new keyword. | 41 // If params has a searchable form, this tries to create a new keyword. |
| 38 void GenerateKeywordIfNecessary(content::NavigationHandle* handle); | 42 void GenerateKeywordIfNecessary(content::NavigationHandle* handle); |
| 39 | 43 |
| 44 mojo::Binding<chrome::mojom::OSDDHandler> osdd_handler_binding_; | |
|
Sam McNally
2017/03/15 00:38:48
A mojo::Binding only supports a single connection;
martis
2017/03/15 05:00:56
Done. I removed the WeakPtr (based on other uses o
| |
| 45 | |
| 46 base::WeakPtrFactory<SearchEngineTabHelper> weak_factory_; | |
| 47 | |
| 40 DISALLOW_COPY_AND_ASSIGN(SearchEngineTabHelper); | 48 DISALLOW_COPY_AND_ASSIGN(SearchEngineTabHelper); |
| 41 }; | 49 }; |
| 42 | 50 |
| 43 #endif // CHROME_BROWSER_UI_SEARCH_ENGINES_SEARCH_ENGINE_TAB_HELPER_H_ | 51 #endif // CHROME_BROWSER_UI_SEARCH_ENGINES_SEARCH_ENGINE_TAB_HELPER_H_ |
| OLD | NEW |