Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(68)

Side by Side Diff: chrome/browser/android/media_in_product_help_manager.h

Issue 2943983003: chrome/blink: Add functionality for in-product help for media elements. (Closed)
Patch Set: addressed comments Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 {
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 // TODO(khushalsagar): Listen to navigations/process crash to dismiss the
40 // widget in the browser.
41 void RenderFrameCreated(content::RenderFrameHost* render_frame_host) override;
42 void RenderFrameDeleted(content::RenderFrameHost* render_frame_host) override;
43
44 private:
45 class MediaInProductHelp;
46
47 // Methods used by MediaInProductHelpService to plumb notifications from the
48 // renderer.
49 void ShowInProductHelpWidget(content::RenderFrameHost* render_frame_host,
50 const gfx::Rect& rect_in_main_frame);
51 void HideInProductHelpWidget(content::RenderFrameHost* render_frame_host);
52
53 // Creates the mojo service exposed to the renderer.
54 void CreateInProductHelpService(
55 content::RenderFrameHost* render_frame_host,
56 const service_manager::BindSourceInfo& source_info,
57 blink::mojom::MediaInProductHelpRequest request);
58 void DismissUI();
59
60 content::RenderFrameHost* active_render_frame_host_ = nullptr;
61 MediaInProductHelpManagerClient* client_;
nyquist 2017/06/29 02:10:24 Nit: Could you add a comment describing the owners
Khushal 2017/07/07 04:18:14 Done.
62 base::WeakPtrFactory<MediaInProductHelpManager> weak_factory_;
63
64 DISALLOW_COPY_AND_ASSIGN(MediaInProductHelpManager);
65 };
66
67 #endif // CHROME_BROWSER_ANDROID_MEDIA_IN_PRODUCT_HELP_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698