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

Side by Side Diff: chrome/browser/content_settings/mixed_content_settings_tab_helper.cc

Issue 2882513005: Propagate opener to BackgroundsContents. (Closed)
Patch Set: Tweaked the comment in DriveWebContentsManager::ShouldCreateWebContents Created 3 years, 6 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
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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/content_settings/mixed_content_settings_tab_helper.h" 5 #include "chrome/browser/content_settings/mixed_content_settings_tab_helper.h"
6 6
7 #include "content/public/browser/browser_thread.h" 7 #include "content/public/browser/browser_thread.h"
8 #include "content/public/browser/navigation_handle.h" 8 #include "content/public/browser/navigation_handle.h"
9 #include "content/public/browser/render_frame_host.h" 9 #include "content/public/browser/render_frame_host.h"
10 #include "content/public/browser/site_instance.h" 10 #include "content/public/browser/site_instance.h"
11 11
12 using content::BrowserThread; 12 using content::BrowserThread;
13 using content::WebContents; 13 using content::WebContents;
14 14
15 DEFINE_WEB_CONTENTS_USER_DATA_KEY(MixedContentSettingsTabHelper); 15 DEFINE_WEB_CONTENTS_USER_DATA_KEY(MixedContentSettingsTabHelper);
16 16
17 MixedContentSettingsTabHelper::MixedContentSettingsTabHelper(WebContents* tab) 17 MixedContentSettingsTabHelper::MixedContentSettingsTabHelper(WebContents* tab)
18 : content::WebContentsObserver(tab) { 18 : content::WebContentsObserver(tab) {
19 if (!tab->HasOpener()) 19 if (!tab->HasOpener())
20 return; 20 return;
21 21
22 // Note: using the opener WebContents to override these values only works 22 // Note: using the opener WebContents to override these values only works
23 // because in Chrome these settings are maintained at the tab level instead of 23 // because in Chrome these settings are maintained at the tab level instead of
24 // at the frame level as Blink does. 24 // at the frame level as Blink does.
25 MixedContentSettingsTabHelper* opener_settings = 25 MixedContentSettingsTabHelper* opener_settings =
26 MixedContentSettingsTabHelper::FromWebContents(tab->GetOpener()); 26 MixedContentSettingsTabHelper::FromWebContents(
27 WebContents::FromRenderFrameHost(tab->GetOpener()));
27 if (opener_settings) { 28 if (opener_settings) {
28 insecure_content_site_instance_ = 29 insecure_content_site_instance_ =
29 opener_settings->insecure_content_site_instance_; 30 opener_settings->insecure_content_site_instance_;
30 is_running_insecure_content_allowed_ = 31 is_running_insecure_content_allowed_ =
31 opener_settings->is_running_insecure_content_allowed_; 32 opener_settings->is_running_insecure_content_allowed_;
32 } 33 }
33 } 34 }
34 35
35 MixedContentSettingsTabHelper::~MixedContentSettingsTabHelper() {} 36 MixedContentSettingsTabHelper::~MixedContentSettingsTabHelper() {}
36 37
(...skipping 18 matching lines...) Expand all
55 // Note: even though on the renderer this setting exists on a per frame basis, 56 // Note: even though on the renderer this setting exists on a per frame basis,
56 // it has always been controlled at the WebContents level. Its value is always 57 // it has always been controlled at the WebContents level. Its value is always
57 // inherited from the parent frame and when changed the whole tree is updated. 58 // inherited from the parent frame and when changed the whole tree is updated.
58 content::SiteInstance* new_site = 59 content::SiteInstance* new_site =
59 navigation_handle->GetRenderFrameHost()->GetSiteInstance(); 60 navigation_handle->GetRenderFrameHost()->GetSiteInstance();
60 if (new_site != insecure_content_site_instance_) { 61 if (new_site != insecure_content_site_instance_) {
61 insecure_content_site_instance_ = nullptr; 62 insecure_content_site_instance_ = nullptr;
62 is_running_insecure_content_allowed_ = false; 63 is_running_insecure_content_allowed_ = false;
63 } 64 }
64 } 65 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698