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

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: move to button 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 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..f434a1e5ac0bc6d10b4427bf7d930fe6a1619be8
--- /dev/null
+++ b/chrome/browser/android/media_in_product_help_manager.h
@@ -0,0 +1,66 @@
+// 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 {
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.
+ 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.
+ void RenderFrameCreated(content::RenderFrameHost* render_frame_host) override;
+ void RenderFrameDeleted(content::RenderFrameHost* render_frame_host) override;
+
+ private:
+ class MediaInProductHelp;
+
+ // Used by MediaInProductHelpService to plumb notifications from the renderer.
+ void ShowInProductHelpWidget(const gfx::Rect& rect_in_main_frame);
+
+ // Called when the connection to the renderer is closed.
+ void OnConnectionError();
+
+ // 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);
+
+ std::unique_ptr<MediaInProductHelp> media_in_product_help_;
+
+ // The |client_| outlives this class.
+ MediaInProductHelpManagerClient* client_;
+ 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