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

Side by Side Diff: chrome/browser/extensions/api/offscreen_tabs/offscreen_tabs_api.cc

Issue 10868072: Make TabContents ctor private; poke hole for existing callers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: all green Created 8 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 (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 #include "chrome/browser/extensions/api/offscreen_tabs/offscreen_tabs_api.h" 5 #include "chrome/browser/extensions/api/offscreen_tabs/offscreen_tabs_api.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/hash_tables.h" 10 #include "base/hash_tables.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 using content::NavigationController; 45 using content::NavigationController;
46 using content::NotificationDetails; 46 using content::NotificationDetails;
47 using content::NotificationSource; 47 using content::NotificationSource;
48 using content::WebContents; 48 using content::WebContents;
49 using WebKit::WebInputEvent; 49 using WebKit::WebInputEvent;
50 50
51 namespace keys = extensions::offscreen_tabs_constants; 51 namespace keys = extensions::offscreen_tabs_constants;
52 namespace tabs_keys = extensions::tabs_constants; 52 namespace tabs_keys = extensions::tabs_constants;
53 namespace events = extensions::event_names; 53 namespace events = extensions::event_names;
54 54
55 // TODO(avi): Kill this when TabContents goes away.
56 class OffscreenTabContentsCreator {
57 public:
58 static TabContents* CreateTabContents(content::WebContents* contents) {
59 return TabContents::Factory::CreateTabContents(contents);
60 }
61 };
62
55 namespace { 63 namespace {
56 64
57 class ParentTab; 65 class ParentTab;
58 66
59 // This class is responsible for the life cycle of an offscreen tab. 67 // This class is responsible for the life cycle of an offscreen tab.
60 class OffscreenTab : public content::NotificationObserver { 68 class OffscreenTab : public content::NotificationObserver {
61 public: 69 public:
62 OffscreenTab(); 70 OffscreenTab();
63 virtual ~OffscreenTab(); 71 virtual ~OffscreenTab();
64 void Init(const GURL& url, 72 void Init(const GURL& url,
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 OffscreenTab::~OffscreenTab() {} 229 OffscreenTab::~OffscreenTab() {}
222 230
223 void OffscreenTab::Init(const GURL& url, 231 void OffscreenTab::Init(const GURL& url,
224 const int width, 232 const int width,
225 const int height, 233 const int height,
226 Profile* profile, 234 Profile* profile,
227 ParentTab* parent_tab) { 235 ParentTab* parent_tab) {
228 // Create the offscreen tab. 236 // Create the offscreen tab.
229 WebContents* web_contents = WebContents::Create( 237 WebContents* web_contents = WebContents::Create(
230 profile, NULL, MSG_ROUTING_NONE, NULL); 238 profile, NULL, MSG_ROUTING_NONE, NULL);
231 tab_contents_.reset(new TabContents(web_contents)); 239 tab_contents_.reset(
240 OffscreenTabContentsCreator::CreateTabContents(web_contents));
232 241
233 // Setting the size starts the renderer. 242 // Setting the size starts the renderer.
234 SetSize(width, height); 243 SetSize(width, height);
235 NavigateToURL(url); 244 NavigateToURL(url);
236 245
237 parent_tab_ = parent_tab; 246 parent_tab_ = parent_tab;
238 247
239 // Register for tab notifications. 248 // Register for tab notifications.
240 registrar_.Add( 249 registrar_.Add(
241 this, 250 this,
(...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after
830 // async case (when a "javascript": URL is sent to a tab). 839 // async case (when a "javascript": URL is sent to a tab).
831 if (!is_async) 840 if (!is_async)
832 SendResponse(true); 841 SendResponse(true);
833 842
834 return true; 843 return true;
835 } 844 }
836 845
837 void UpdateOffscreenTabFunction::PopulateResult() { 846 void UpdateOffscreenTabFunction::PopulateResult() {
838 // There's no result associated with this callback. 847 // There's no result associated with this callback.
839 } 848 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/identity/web_auth_flow.cc ('k') | chrome/browser/extensions/extension_tab_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698