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

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

Issue 2943983003: chrome/blink: Add functionality for in-product help for media elements. (Closed)
Patch Set: not on pause. 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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_ANDROID_TAB_ANDROID_H_ 5 #ifndef CHROME_BROWSER_ANDROID_TAB_ANDROID_H_
6 #define CHROME_BROWSER_ANDROID_TAB_ANDROID_H_ 6 #define CHROME_BROWSER_ANDROID_TAB_ANDROID_H_
7 7
8 #include <jni.h> 8 #include <jni.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
11 #include <memory> 11 #include <memory>
12 12
13 #include "base/android/jni_weak_ref.h" 13 #include "base/android/jni_weak_ref.h"
14 #include "base/android/scoped_java_ref.h" 14 #include "base/android/scoped_java_ref.h"
15 #include "base/callback_forward.h" 15 #include "base/callback_forward.h"
16 #include "base/macros.h" 16 #include "base/macros.h"
17 #include "base/memory/weak_ptr.h"
17 #include "base/strings/string16.h" 18 #include "base/strings/string16.h"
18 #include "chrome/browser/sync/glue/synced_tab_delegate_android.h" 19 #include "chrome/browser/sync/glue/synced_tab_delegate_android.h"
19 #include "chrome/browser/ui/tab_contents/core_tab_helper_delegate.h" 20 #include "chrome/browser/ui/tab_contents/core_tab_helper_delegate.h"
20 #include "components/favicon/core/favicon_driver_observer.h" 21 #include "components/favicon/core/favicon_driver_observer.h"
21 #include "components/infobars/core/infobar_manager.h" 22 #include "components/infobars/core/infobar_manager.h"
22 #include "components/sessions/core/session_id.h" 23 #include "components/sessions/core/session_id.h"
23 #include "components/toolbar/toolbar_model.h" 24 #include "components/toolbar/toolbar_model.h"
24 #include "content/public/browser/notification_observer.h" 25 #include "content/public/browser/notification_observer.h"
25 #include "content/public/browser/notification_registrar.h" 26 #include "content/public/browser/notification_registrar.h"
27 #include "content/public/browser/web_contents_observer.h"
28 #include "services/service_manager/public/cpp/binder_registry.h"
29 #include "third_party/WebKit/public/platform/media_in_product_help.mojom.h"
26 30
27 class GURL; 31 class GURL;
28 class Profile; 32 class Profile;
29 33
30 namespace cc { 34 namespace cc {
31 class Layer; 35 class Layer;
32 } 36 }
33 37
34 namespace chrome { 38 namespace chrome {
35 struct NavigateParams; 39 struct NavigateParams;
36 } 40 }
37 41
38 namespace android { 42 namespace android {
39 class TabWebContentsDelegateAndroid; 43 class TabWebContentsDelegateAndroid;
40 class TabContentManager; 44 class TabContentManager;
41 } 45 }
42 46
43 namespace content { 47 namespace content {
44 class DevToolsAgentHost; 48 class DevToolsAgentHost;
45 class WebContents; 49 class WebContents;
46 } 50 }
47 51
48 namespace prerender { 52 namespace prerender {
49 class PrerenderManager; 53 class PrerenderManager;
50 } 54 }
51 55
52 class TabAndroid : public CoreTabHelperDelegate, 56 class TabAndroid : public CoreTabHelperDelegate,
53 public content::NotificationObserver, 57 public content::NotificationObserver,
54 public favicon::FaviconDriverObserver { 58 public favicon::FaviconDriverObserver,
59 public content::WebContentsObserver {
55 public: 60 public:
56 // A Java counterpart will be generated for this enum. 61 // A Java counterpart will be generated for this enum.
57 // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.chrome.browser 62 // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.chrome.browser
58 enum TabLoadStatus { 63 enum TabLoadStatus {
59 PAGE_LOAD_FAILED = 0, 64 PAGE_LOAD_FAILED = 0,
60 DEFAULT_PAGE_LOAD = 1, 65 DEFAULT_PAGE_LOAD = 1,
61 PARTIAL_PRERENDERED_PAGE_LOAD = 2, 66 PARTIAL_PRERENDERED_PAGE_LOAD = 2,
62 FULL_PRERENDERED_PAGE_LOAD = 3, 67 FULL_PRERENDERED_PAGE_LOAD = 3,
63 }; 68 };
64 69
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 244
240 const std::string& GetWebappManifestScope() const { 245 const std::string& GetWebappManifestScope() const {
241 return webapp_manifest_scope_; 246 return webapp_manifest_scope_;
242 } 247 }
243 248
244 void EnableEmbeddedMediaExperience( 249 void EnableEmbeddedMediaExperience(
245 JNIEnv* env, 250 JNIEnv* env,
246 const base::android::JavaParamRef<jobject>& obj, 251 const base::android::JavaParamRef<jobject>& obj,
247 jboolean enabled); 252 jboolean enabled);
248 253
254 void DownloadMediaInProductHelpDismissed(
255 JNIEnv* env,
256 const base::android::JavaParamRef<jobject>& obj);
257
249 bool ShouldEnableEmbeddedMediaExperience() const; 258 bool ShouldEnableEmbeddedMediaExperience() const;
250 259
251 scoped_refptr<content::DevToolsAgentHost> GetDevToolsAgentHost(); 260 scoped_refptr<content::DevToolsAgentHost> GetDevToolsAgentHost();
252 261
253 void SetDevToolsAgentHost(scoped_refptr<content::DevToolsAgentHost> host); 262 void SetDevToolsAgentHost(scoped_refptr<content::DevToolsAgentHost> host);
254 263
255 void AttachDetachedTab(JNIEnv* env, 264 void AttachDetachedTab(JNIEnv* env,
256 const base::android::JavaParamRef<jobject>& obj); 265 const base::android::JavaParamRef<jobject>& obj);
257 266
258 // Register the Tab's native methods through JNI. 267 // Register the Tab's native methods through JNI.
259 static bool RegisterTabAndroid(JNIEnv* env); 268 static bool RegisterTabAndroid(JNIEnv* env);
260 269
270 // content::WebContents implementation.
271 void RenderFrameCreated(content::RenderFrameHost* render_frame_host) override;
272 void RenderFrameDeleted(content::RenderFrameHost* render_frame_host) override;
273
261 private: 274 private:
275 class MediaInProductHelp;
276
262 prerender::PrerenderManager* GetPrerenderManager() const; 277 prerender::PrerenderManager* GetPrerenderManager() const;
263 278
279 // methods used by MediaInProductHelp.
280 void CreateInProductHelpService(
281 content::RenderFrameHost* render_frame_host,
282 const service_manager::BindSourceInfo& source_info,
283 blink::mojom::MediaInProductHelpRequest request);
284 void ShowMediaDownloadInProductHelp(const gfx::Rect& rect_in_frame);
285 void DismissMediaDownloadInProductHelp();
286 void OnMediaInProductHelpConnectionError();
287
264 JavaObjectWeakGlobalRef weak_java_tab_; 288 JavaObjectWeakGlobalRef weak_java_tab_;
265 289
266 // The identifier used by session restore for this tab. 290 // The identifier used by session restore for this tab.
267 SessionID session_tab_id_; 291 SessionID session_tab_id_;
268 292
269 // Identifier of the window the tab is in. 293 // Identifier of the window the tab is in.
270 SessionID session_window_id_; 294 SessionID session_window_id_;
271 295
272 content::NotificationRegistrar notification_registrar_; 296 content::NotificationRegistrar notification_registrar_;
273 297
274 scoped_refptr<cc::Layer> content_layer_; 298 scoped_refptr<cc::Layer> content_layer_;
275 android::TabContentManager* tab_content_manager_; 299 android::TabContentManager* tab_content_manager_;
276 300
277 std::unique_ptr<content::WebContents> web_contents_; 301 std::unique_ptr<content::WebContents> web_contents_;
278 std::unique_ptr<android::TabWebContentsDelegateAndroid> 302 std::unique_ptr<android::TabWebContentsDelegateAndroid>
279 web_contents_delegate_; 303 web_contents_delegate_;
280 scoped_refptr<content::DevToolsAgentHost> devtools_host_; 304 scoped_refptr<content::DevToolsAgentHost> devtools_host_;
281 std::unique_ptr<browser_sync::SyncedTabDelegateAndroid> synced_tab_delegate_; 305 std::unique_ptr<browser_sync::SyncedTabDelegateAndroid> synced_tab_delegate_;
282 306
283 std::string webapp_manifest_scope_; 307 std::string webapp_manifest_scope_;
284 bool embedded_media_experience_enabled_; 308 bool embedded_media_experience_enabled_;
285 309
310 std::unique_ptr<MediaInProductHelp> media_in_product_help_;
311
312 base::WeakPtrFactory<TabAndroid> weak_factory_;
313
286 DISALLOW_COPY_AND_ASSIGN(TabAndroid); 314 DISALLOW_COPY_AND_ASSIGN(TabAndroid);
287 }; 315 };
288 316
289 #endif // CHROME_BROWSER_ANDROID_TAB_ANDROID_H_ 317 #endif // CHROME_BROWSER_ANDROID_TAB_ANDROID_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698