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

Side by Side Diff: apps/custom_launcher_page_contents.cc

Issue 1432143002: Track where WebContents are created in order to better understand issue. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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 #include "apps/custom_launcher_page_contents.h" 5 #include "apps/custom_launcher_page_contents.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "chrome/browser/chrome_notification_types.h" 9 #include "chrome/browser/chrome_notification_types.h"
10 #include "chrome/browser/extensions/chrome_extension_web_contents_observer.h" 10 #include "chrome/browser/extensions/chrome_extension_web_contents_observer.h"
11 #include "content/public/browser/render_view_host.h" 11 #include "content/public/browser/render_view_host.h"
12 #include "content/public/browser/site_instance.h" 12 #include "content/public/browser/site_instance.h"
13 #include "content/public/browser/web_contents.h" 13 #include "content/public/browser/web_contents.h"
14 #include "content/public/browser/web_contents_source.h"
14 #include "content/public/common/renderer_preferences.h" 15 #include "content/public/common/renderer_preferences.h"
15 #include "extensions/browser/app_window/app_delegate.h" 16 #include "extensions/browser/app_window/app_delegate.h"
16 #include "extensions/browser/app_window/app_web_contents_helper.h" 17 #include "extensions/browser/app_window/app_web_contents_helper.h"
17 #include "extensions/browser/view_type_utils.h" 18 #include "extensions/browser/view_type_utils.h"
18 #include "extensions/common/extension_messages.h" 19 #include "extensions/common/extension_messages.h"
19 20
20 namespace apps { 21 namespace apps {
21 22
22 CustomLauncherPageContents::CustomLauncherPageContents( 23 CustomLauncherPageContents::CustomLauncherPageContents(
23 scoped_ptr<extensions::AppDelegate> app_delegate, 24 scoped_ptr<extensions::AppDelegate> app_delegate,
24 const std::string& extension_id) 25 const std::string& extension_id)
25 : app_delegate_(app_delegate.Pass()), extension_id_(extension_id) { 26 : app_delegate_(app_delegate.Pass()), extension_id_(extension_id) {
26 } 27 }
27 28
28 CustomLauncherPageContents::~CustomLauncherPageContents() { 29 CustomLauncherPageContents::~CustomLauncherPageContents() {
29 } 30 }
30 31
31 void CustomLauncherPageContents::Initialize(content::BrowserContext* context, 32 void CustomLauncherPageContents::Initialize(content::BrowserContext* context,
32 const GURL& url) { 33 const GURL& url) {
33 web_contents_.reset( 34 web_contents_.reset(
34 content::WebContents::Create(content::WebContents::CreateParams( 35 content::WebContents::Create(content::WebContents::CreateParams(
35 context, content::SiteInstance::CreateForURL(context, url)))); 36 context, content::SiteInstance::CreateForURL(context, url))));
36 37
38 WebContentsSource::CreateForWebContentsAndLocation(web_contents_.get(),
39 FROM_HERE);
37 web_contents_->GetMutableRendererPrefs() 40 web_contents_->GetMutableRendererPrefs()
38 ->browser_handles_all_top_level_requests = true; 41 ->browser_handles_all_top_level_requests = true;
39 web_contents_->GetRenderViewHost()->SyncRendererPrefs(); 42 web_contents_->GetRenderViewHost()->SyncRendererPrefs();
40 43
41 helper_.reset(new extensions::AppWebContentsHelper( 44 helper_.reset(new extensions::AppWebContentsHelper(
42 context, extension_id_, web_contents_.get(), app_delegate_.get())); 45 context, extension_id_, web_contents_.get(), app_delegate_.get()));
43 web_contents_->SetDelegate(this); 46 web_contents_->SetDelegate(this);
44 47
45 extensions::SetViewType(web_contents(), extensions::VIEW_TYPE_LAUNCHER_PAGE); 48 extensions::SetViewType(web_contents(), extensions::VIEW_TYPE_LAUNCHER_PAGE);
46 49
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 128
126 bool CustomLauncherPageContents::CheckMediaAccessPermission( 129 bool CustomLauncherPageContents::CheckMediaAccessPermission(
127 content::WebContents* web_contents, 130 content::WebContents* web_contents,
128 const GURL& security_origin, 131 const GURL& security_origin,
129 content::MediaStreamType type) { 132 content::MediaStreamType type) {
130 DCHECK_EQ(web_contents_.get(), web_contents); 133 DCHECK_EQ(web_contents_.get(), web_contents);
131 return helper_->CheckMediaAccessPermission(security_origin, type); 134 return helper_->CheckMediaAccessPermission(security_origin, type);
132 } 135 }
133 136
134 } // namespace apps 137 } // namespace apps
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698