OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_BROWSER_ANDROID_MEDIA_IN_PRODUCT_HELP_MANAGER_H_ | |
6 #define CHROME_BROWSER_ANDROID_MEDIA_IN_PRODUCT_HELP_MANAGER_H_ | |
7 | |
8 #include "base/memory/weak_ptr.h" | |
9 #include "content/public/browser/web_contents_observer.h" | |
10 #include "services/service_manager/public/cpp/binder_registry.h" | |
11 #include "third_party/WebKit/public/platform/media_in_product_help.mojom.h" | |
12 | |
13 class MediaInProductHelpManagerClient { | |
14 public: | |
15 ~MediaInProductHelpManagerClient() {} | |
16 | |
17 // Updates the position of the InProductHelp widget. |rect_in_frame| provides | |
18 // the position of the widget in the space of the renderer's main frame. | |
19 virtual void ShowMediaDownloadInProductHelp( | |
20 const gfx::Rect& rect_in_frame) = 0; | |
21 | |
22 // Request to dismiss the InProductHelp widget. This request must be | |
23 // acknowledged using MediaInProductHelpManager::WidgetDismissed once the | |
24 // widget is removed. | |
25 virtual void DismissMediaDownloadInProductHelp() = 0; | |
26 }; | |
27 | |
28 class MediaInProductHelpManager : public content::WebContentsObserver { | |
Khushal
2017/07/10 20:38:02
This class isn't really doing anything useful anym
David Trainor- moved to gerrit
2017/07/11 16:34:42
Merging it makes sense to me :)
Khushal
2017/07/11 20:34:36
Done.
| |
29 public: | |
30 MediaInProductHelpManager(content::WebContents* web_contents, | |
31 MediaInProductHelpManagerClient* client); | |
32 ~MediaInProductHelpManager() override; | |
33 | |
34 // Notifies when the InProductHelp widget requested from the client is | |
35 // removed. | |
36 void WidgetDismissed(); | |
37 | |
38 // content::WebContentsObserver implementation. | |
39 void RenderFrameCreated(content::RenderFrameHost* render_frame_host) override; | |
40 void RenderFrameDeleted(content::RenderFrameHost* render_frame_host) override; | |
41 | |
42 private: | |
43 class MediaInProductHelp; | |
44 | |
45 // Used by MediaInProductHelpService to plumb notifications from the renderer. | |
46 void ShowInProductHelpWidget(const gfx::Rect& rect_in_main_frame); | |
47 | |
48 // Called when the connection to the renderer is closed. | |
49 void OnConnectionError(); | |
50 | |
51 // Creates the mojo service exposed to the renderer. | |
52 void CreateInProductHelpService( | |
53 content::RenderFrameHost* render_frame_host, | |
54 const service_manager::BindSourceInfo& source_info, | |
55 blink::mojom::MediaInProductHelpRequest request); | |
56 | |
57 std::unique_ptr<MediaInProductHelp> media_in_product_help_; | |
58 | |
59 // The |client_| outlives this class. | |
60 MediaInProductHelpManagerClient* client_; | |
61 base::WeakPtrFactory<MediaInProductHelpManager> weak_factory_; | |
62 | |
63 DISALLOW_COPY_AND_ASSIGN(MediaInProductHelpManager); | |
64 }; | |
65 | |
66 #endif // CHROME_BROWSER_ANDROID_MEDIA_IN_PRODUCT_HELP_MANAGER_H_ | |
OLD | NEW |