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

Side by Side Diff: chrome/browser/guest_view/guest_view_base.h

Issue 426593007: Refactor guest view availability to be API not permission based. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: done 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
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_GUEST_VIEW_BASE_H_ 5 #ifndef CHROME_BROWSER_GUEST_VIEW_GUEST_VIEW_BASE_H_
6 #define CHROME_BROWSER_GUEST_VIEW_GUEST_VIEW_BASE_H_ 6 #define CHROME_BROWSER_GUEST_VIEW_GUEST_VIEW_BASE_H_
7 7
8 #include <queue> 8 #include <queue>
9 9
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 // This method can be overriden by subclasses. This gives the derived class 134 // This method can be overriden by subclasses. This gives the derived class
135 // an opportunity to perform setup actions before attachment. 135 // an opportunity to perform setup actions before attachment.
136 virtual void WillAttachToEmbedder() {} 136 virtual void WillAttachToEmbedder() {}
137 137
138 // This method is called when the guest WebContents is about to be destroyed. 138 // This method is called when the guest WebContents is about to be destroyed.
139 // 139 //
140 // This gives the derived class an opportunity to perform some cleanup prior 140 // This gives the derived class an opportunity to perform some cleanup prior
141 // to destruction. 141 // to destruction.
142 virtual void WillDestroy() {} 142 virtual void WillDestroy() {}
143 143
144 // This method is to be implemented by the derived class. It determines 144 // This method is to be implemented by the derived class. Access to guest
145 // whether the guest view type of the derived class can be used by the 145 // views are determined by the availability of the internal extension API
146 // provided embedder extension ID. 146 // used to implement the guest view.
147 virtual bool CanEmbedderUseGuestView( 147 //
148 const std::string& embedder_extension_id) = 0; 148 // This should be the name of the API as it appears in the _api_features.json
149 // file.
150 virtual const char* GetApiNamespace() = 0;
Fady Samuel 2014/08/07 23:01:18 nit: Should this be GetAPINamespace?
not at google - send to devlin 2014/08/07 23:02:56 up to you I suppose, I'm not fussed. GetAPINamespa
149 151
150 // This method is to be implemented by the derived class. Given a set of 152 // This method is to be implemented by the derived class. Given a set of
151 // initialization parameters, a concrete subclass of GuestViewBase can 153 // initialization parameters, a concrete subclass of GuestViewBase can
152 // create a specialized WebContents that it returns back to GuestViewBase. 154 // create a specialized WebContents that it returns back to GuestViewBase.
153 typedef base::Callback<void(content::WebContents*)> 155 typedef base::Callback<void(content::WebContents*)>
154 WebContentsCreatedCallback; 156 WebContentsCreatedCallback;
155 virtual void CreateWebContents( 157 virtual void CreateWebContents(
156 const std::string& embedder_extension_id, 158 const std::string& embedder_extension_id,
157 int embedder_render_process_id, 159 int embedder_render_process_id,
158 const base::DictionaryValue& create_params, 160 const base::DictionaryValue& create_params,
159 const WebContentsCreatedCallback& callback) = 0; 161 const WebContentsCreatedCallback& callback) = 0;
160 162
161 // This creates a WebContents and initializes |this| GuestViewBase to use the 163 // This creates a WebContents and initializes |this| GuestViewBase to use the
162 // newly created WebContents. 164 // newly created WebContents.
163 void Init(const std::string& embedder_extension_id, 165 void Init(const std::string& embedder_extension_id,
164 int embedder_render_process_id, 166 content::WebContents* embedder_web_contents,
165 const base::DictionaryValue& create_params, 167 const base::DictionaryValue& create_params,
166 const WebContentsCreatedCallback& callback); 168 const WebContentsCreatedCallback& callback);
167 169
168 void InitWithWebContents( 170 void InitWithWebContents(
169 const std::string& embedder_extension_id, 171 const std::string& embedder_extension_id,
170 int embedder_render_process_id, 172 int embedder_render_process_id,
171 content::WebContents* guest_web_contents); 173 content::WebContents* guest_web_contents);
172 174
173 bool IsViewType(const char* const view_type) const { 175 bool IsViewType(const char* const view_type) const {
174 return !strcmp(GetViewType(), view_type); 176 return !strcmp(GetViewType(), view_type);
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 gfx::Size min_auto_size_; 326 gfx::Size min_auto_size_;
325 327
326 // This is used to ensure pending tasks will not fire after this object is 328 // This is used to ensure pending tasks will not fire after this object is
327 // destroyed. 329 // destroyed.
328 base::WeakPtrFactory<GuestViewBase> weak_ptr_factory_; 330 base::WeakPtrFactory<GuestViewBase> weak_ptr_factory_;
329 331
330 DISALLOW_COPY_AND_ASSIGN(GuestViewBase); 332 DISALLOW_COPY_AND_ASSIGN(GuestViewBase);
331 }; 333 };
332 334
333 #endif // CHROME_BROWSER_GUEST_VIEW_GUEST_VIEW_BASE_H_ 335 #endif // CHROME_BROWSER_GUEST_VIEW_GUEST_VIEW_BASE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698