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

Unified 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, 6 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/android/media_in_product_help_manager.h
diff --git a/chrome/browser/android/media_in_product_help_manager.h b/chrome/browser/android/media_in_product_help_manager.h
new file mode 100644
index 0000000000000000000000000000000000000000..a1239fe3cf7d978daa3c8e977130535e85fe4326
--- /dev/null
+++ b/chrome/browser/android/media_in_product_help_manager.h
@@ -0,0 +1,67 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_ANDROID_MEDIA_IN_PRODUCT_HELP_MANAGER_H_
+#define CHROME_BROWSER_ANDROID_MEDIA_IN_PRODUCT_HELP_MANAGER_H_
+
+#include "base/memory/weak_ptr.h"
+#include "content/public/browser/web_contents_observer.h"
+#include "services/service_manager/public/cpp/binder_registry.h"
+#include "third_party/WebKit/public/platform/media_in_product_help.mojom.h"
+
+class MediaInProductHelpManagerClient {
+ public:
+ ~MediaInProductHelpManagerClient() {}
+
+ // Updates the position of the InProductHelp widget. |rect_in_frame| provides
+ // the position of the widget in the space of the renderer's main frame.
+ virtual void ShowMediaDownloadInProductHelp(
+ const gfx::Rect& rect_in_frame) = 0;
+
+ // Request to dismiss the InProductHelp widget. This request must be
+ // acknowledged using MediaInProductHelpManager::WidgetDismissed once the
+ // widget is removed.
+ virtual void DismissMediaDownloadInProductHelp() = 0;
+};
+
+class MediaInProductHelpManager : public content::WebContentsObserver {
+ public:
+ MediaInProductHelpManager(content::WebContents* web_contents,
+ MediaInProductHelpManagerClient* client);
+ ~MediaInProductHelpManager() override;
+
+ // Notifies when the InProductHelp widget requested from the client is
+ // removed.
+ void WidgetDismissed();
+
+ // content::WebContentsObserver implementation.
+ // TODO(khushalsagar): Listen to navigations/process crash to dismiss the
+ // widget in the browser.
+ void RenderFrameCreated(content::RenderFrameHost* render_frame_host) override;
+ void RenderFrameDeleted(content::RenderFrameHost* render_frame_host) override;
+
+ private:
+ class MediaInProductHelp;
+
+ // Methods used by MediaInProductHelpService to plumb notifications from the
+ // renderer.
+ void ShowInProductHelpWidget(content::RenderFrameHost* render_frame_host,
+ const gfx::Rect& rect_in_main_frame);
+ void HideInProductHelpWidget(content::RenderFrameHost* render_frame_host);
+
+ // Creates the mojo service exposed to the renderer.
+ void CreateInProductHelpService(
+ content::RenderFrameHost* render_frame_host,
+ const service_manager::BindSourceInfo& source_info,
+ blink::mojom::MediaInProductHelpRequest request);
+ void DismissUI();
+
+ content::RenderFrameHost* active_render_frame_host_ = nullptr;
+ 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.
+ base::WeakPtrFactory<MediaInProductHelpManager> weak_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(MediaInProductHelpManager);
+};
+
+#endif // CHROME_BROWSER_ANDROID_MEDIA_IN_PRODUCT_HELP_MANAGER_H_

Powered by Google App Engine
This is Rietveld 408576698