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

Side by Side Diff: trunk/src/apps/app_window_contents.cc

Issue 163913004: Revert 250826 "Remove Profile dependency from apps::ShellWindow" (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 10 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "apps/app_window_contents.h" 5 #include "apps/app_window_contents.h"
6 6
7 #include "apps/ui/native_app_window.h" 7 #include "apps/ui/native_app_window.h"
8 #include "chrome/browser/chrome_notification_types.h" 8 #include "chrome/browser/chrome_notification_types.h"
9 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/common/extensions/api/app_window.h" 10 #include "chrome/common/extensions/api/app_window.h"
10 #include "chrome/common/extensions/extension_messages.h" 11 #include "chrome/common/extensions/extension_messages.h"
11 #include "content/public/browser/browser_context.h"
12 #include "content/public/browser/browser_thread.h" 12 #include "content/public/browser/browser_thread.h"
13 #include "content/public/browser/render_process_host.h" 13 #include "content/public/browser/render_process_host.h"
14 #include "content/public/browser/render_view_host.h" 14 #include "content/public/browser/render_view_host.h"
15 #include "content/public/browser/resource_dispatcher_host.h" 15 #include "content/public/browser/resource_dispatcher_host.h"
16 #include "content/public/browser/site_instance.h" 16 #include "content/public/browser/site_instance.h"
17 #include "content/public/browser/web_contents.h" 17 #include "content/public/browser/web_contents.h"
18 #include "content/public/common/renderer_preferences.h" 18 #include "content/public/common/renderer_preferences.h"
19 19
20 namespace app_window = extensions::api::app_window; 20 namespace app_window = extensions::api::app_window;
21 21
22 namespace apps { 22 namespace apps {
23 23
24 AppWindowContents::AppWindowContents(ShellWindow* host) 24 AppWindowContents::AppWindowContents(ShellWindow* host)
25 : host_(host) { 25 : host_(host) {
26 } 26 }
27 27
28 AppWindowContents::~AppWindowContents() { 28 AppWindowContents::~AppWindowContents() {
29 } 29 }
30 30
31 void AppWindowContents::Initialize(content::BrowserContext* context, 31 void AppWindowContents::Initialize(Profile* profile, const GURL& url) {
32 const GURL& url) {
33 url_ = url; 32 url_ = url;
34 33
35 extension_function_dispatcher_.reset( 34 extension_function_dispatcher_.reset(
36 new ExtensionFunctionDispatcher(context, this)); 35 new ExtensionFunctionDispatcher(profile, this));
37 36
38 web_contents_.reset( 37 web_contents_.reset(content::WebContents::Create(
39 content::WebContents::Create(content::WebContents::CreateParams( 38 content::WebContents::CreateParams(
40 context, content::SiteInstance::CreateForURL(context, url_)))); 39 profile, content::SiteInstance::CreateForURL(profile, url_))));
41 40
42 content::WebContentsObserver::Observe(web_contents_.get()); 41 content::WebContentsObserver::Observe(web_contents_.get());
43 web_contents_->GetMutableRendererPrefs()-> 42 web_contents_->GetMutableRendererPrefs()->
44 browser_handles_all_top_level_requests = true; 43 browser_handles_all_top_level_requests = true;
45 web_contents_->GetRenderViewHost()->SyncRendererPrefs(); 44 web_contents_->GetRenderViewHost()->SyncRendererPrefs();
46 } 45 }
47 46
48 void AppWindowContents::LoadContents(int32 creator_process_id) { 47 void AppWindowContents::LoadContents(int32 creator_process_id) {
49 // If the new view is in the same process as the creator, block the created 48 // If the new view is in the same process as the creator, block the created
50 // RVH from loading anything until the background page has had a chance to 49 // RVH from loading anything until the background page has had a chance to
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 content::RenderViewHost* rvh) { 156 content::RenderViewHost* rvh) {
158 DCHECK(rvh); 157 DCHECK(rvh);
159 content::BrowserThread::PostTask( 158 content::BrowserThread::PostTask(
160 content::BrowserThread::IO, FROM_HERE, 159 content::BrowserThread::IO, FROM_HERE,
161 base::Bind(&content::ResourceDispatcherHost::BlockRequestsForRoute, 160 base::Bind(&content::ResourceDispatcherHost::BlockRequestsForRoute,
162 base::Unretained(content::ResourceDispatcherHost::Get()), 161 base::Unretained(content::ResourceDispatcherHost::Get()),
163 rvh->GetProcess()->GetID(), rvh->GetRoutingID())); 162 rvh->GetProcess()->GetID(), rvh->GetRoutingID()));
164 } 163 }
165 164
166 } // namespace apps 165 } // namespace apps
OLDNEW
« no previous file with comments | « trunk/src/apps/app_window_contents.h ('k') | trunk/src/apps/shell/browser/shell_extensions_browser_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698