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

Side by Side Diff: chrome/browser/guest_view/app_view/app_view_guest.h

Issue 354483004: Implement <appview> (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@app_view_skeleton
Patch Set: Addressed comments Created 6 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_GUEST_VIEW_APP_VIEW_APP_VIEW_GUEST_H_ 5 #ifndef CHROME_BROWSER_GUEST_VIEW_APP_VIEW_APP_VIEW_GUEST_H_
6 #define CHROME_BROWSER_GUEST_VIEW_APP_VIEW_APP_VIEW_GUEST_H_ 6 #define CHROME_BROWSER_GUEST_VIEW_APP_VIEW_APP_VIEW_GUEST_H_
7 7
8 #include "base/id_map.h"
8 #include "chrome/browser/guest_view/guest_view.h" 9 #include "chrome/browser/guest_view/guest_view.h"
10 #include "extensions/browser/extension_function_dispatcher.h"
9 11
10 class AppViewGuest : public GuestView<AppViewGuest> { 12 namespace extensions {
13 class Extension;
14 class ExtensionHost;
15 };
16
17 class AppViewGuest : public GuestView<AppViewGuest>,
18 public extensions::ExtensionFunctionDispatcher::Delegate {
11 public: 19 public:
12 static const char Type[]; 20 static const char Type[];
13 21
22 static bool CompletePendingRequest(
23 const GURL& url,
24 int guest_instance_id,
25 content::BrowserContext* browser_context,
26 const std::string& guest_extension_id);
27
14 AppViewGuest(content::BrowserContext* browser_context, 28 AppViewGuest(content::BrowserContext* browser_context,
15 int guest_instance_id); 29 int guest_instance_id);
16 30
31 // ExtensionFunctionDispatcher::Delegate implementation.
32 virtual extensions::WindowController* GetExtensionWindowController() const
33 OVERRIDE;
34 virtual content::WebContents* GetAssociatedWebContents() const OVERRIDE;
35
36 // content::WebContentsObserver implementation.
37 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
38
39 // content::WebContentsDelegate implementation.
40 virtual bool HandleContextMenu(
41 const content::ContextMenuParams& params) OVERRIDE;
42
17 // GuestViewBase implementation. 43 // GuestViewBase implementation.
18 virtual void CreateWebContents( 44 virtual void CreateWebContents(
19 const std::string& embedder_extension_id, 45 const std::string& embedder_extension_id,
20 int embedder_render_process_id, 46 int embedder_render_process_id,
21 const base::DictionaryValue& create_params, 47 const base::DictionaryValue& create_params,
22 const WebContentsCreatedCallback& callback) OVERRIDE; 48 const WebContentsCreatedCallback& callback) OVERRIDE;
23 virtual void DidAttachToEmbedder() OVERRIDE; 49 virtual void DidAttachToEmbedder() OVERRIDE;
50 virtual void DidInitialize() OVERRIDE;
24 51
25 private: 52 private:
26 virtual ~AppViewGuest(); 53 virtual ~AppViewGuest();
54
55 void OnRequest(const ExtensionHostMsg_Request_Params& params);
56
57 void CompleteCreateWebContents(const GURL& url,
58 const extensions::Extension* guest_extension,
59 const WebContentsCreatedCallback& callback);
60
61 void LaunchAppAndFireEvent(const WebContentsCreatedCallback& callback,
62 extensions::ExtensionHost* extension_host);
63
64 GURL url_;
65 std::string guest_extension_id_;
66 scoped_ptr<extensions::ExtensionFunctionDispatcher>
67 extension_function_dispatcher_;
68
69 // This is used to ensure pending tasks will not fire after this object is
70 // destroyed.
71 base::WeakPtrFactory<AppViewGuest> weak_ptr_factory_;
72
73 DISALLOW_COPY_AND_ASSIGN(AppViewGuest);
27 }; 74 };
28 75
29 #endif // CHROME_BROWSER_GUEST_VIEW_APP_VIEW_APP_VIEW_GUEST_H_ 76 #endif // CHROME_BROWSER_GUEST_VIEW_APP_VIEW_APP_VIEW_GUEST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698