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

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

Issue 486903002: Moving app_view to extensions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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 | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_GUEST_VIEW_APP_VIEW_APP_VIEW_GUEST_H_
6 #define CHROME_BROWSER_GUEST_VIEW_APP_VIEW_APP_VIEW_GUEST_H_
7
8 #include "base/id_map.h"
9 #include "extensions/browser/extension_function_dispatcher.h"
10 #include "extensions/browser/guest_view/guest_view.h"
11
12 namespace extensions {
13 class Extension;
14 class ExtensionHost;
15
16 // An AppViewGuest provides the browser-side implementation of <appview> API.
17 // AppViewGuest is created on attachment. That is, when a guest WebContents is
18 // associated with a particular embedder WebContents. This happens on calls to
19 // the connect API.
20 class AppViewGuest : public GuestView<AppViewGuest>,
21 public ExtensionFunctionDispatcher::Delegate {
22 public:
23 static const char Type[];
24
25 // Completes the creation of a WebContents associated with the provided
26 // |guest_extensions_id|.
27 static bool CompletePendingRequest(
28 content::BrowserContext* browser_context,
29 const GURL& url,
30 int guest_instance_id,
31 const std::string& guest_extension_id);
32
33 static GuestViewBase* Create(content::BrowserContext* browser_context,
34 int guest_instance_id);
35
36 // ExtensionFunctionDispatcher::Delegate implementation.
37 virtual WindowController* GetExtensionWindowController() const OVERRIDE;
38 virtual content::WebContents* GetAssociatedWebContents() const OVERRIDE;
39
40 // content::WebContentsObserver implementation.
41 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
42
43 // content::WebContentsDelegate implementation.
44 virtual bool HandleContextMenu(
45 const content::ContextMenuParams& params) OVERRIDE;
46
47 // GuestViewBase implementation.
48 virtual const char* GetAPINamespace() OVERRIDE;
49 virtual void CreateWebContents(
50 const std::string& embedder_extension_id,
51 int embedder_render_process_id,
52 const base::DictionaryValue& create_params,
53 const WebContentsCreatedCallback& callback) OVERRIDE;
54 virtual void DidAttachToEmbedder() OVERRIDE;
55 virtual void DidInitialize() OVERRIDE;
56
57 private:
58 AppViewGuest(content::BrowserContext* browser_context,
59 int guest_instance_id);
60
61 virtual ~AppViewGuest();
62
63 void OnRequest(const ExtensionHostMsg_Request_Params& params);
64
65 void CompleteCreateWebContents(const GURL& url,
66 const Extension* guest_extension,
67 const WebContentsCreatedCallback& callback);
68
69 void LaunchAppAndFireEvent(scoped_ptr<base::DictionaryValue> data,
70 const WebContentsCreatedCallback& callback,
71 ExtensionHost* extension_host);
72
73 GURL url_;
74 std::string guest_extension_id_;
75 scoped_ptr<ExtensionFunctionDispatcher> extension_function_dispatcher_;
76
77 // This is used to ensure pending tasks will not fire after this object is
78 // destroyed.
79 base::WeakPtrFactory<AppViewGuest> weak_ptr_factory_;
80
81 DISALLOW_COPY_AND_ASSIGN(AppViewGuest);
82 };
83
84 } // namespace extensions
85
86 #endif // CHROME_BROWSER_GUEST_VIEW_APP_VIEW_APP_VIEW_GUEST_H_
OLDNEW
« no previous file with comments | « chrome/browser/guest_view/app_view/app_view_constants.cc ('k') | chrome/browser/guest_view/app_view/app_view_guest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698