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

Side by Side Diff: chrome/browser/guestview/guestview.cc

Issue 78303005: ContentSettings API should not interact with <webview> (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed Jochen's comments Created 7 years 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 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 "chrome/browser/guestview/guestview.h" 5 #include "chrome/browser/guestview/guestview.h"
6 6
7 #include "base/lazy_instance.h" 7 #include "base/lazy_instance.h"
8 #include "chrome/browser/guestview/adview/adview_guest.h" 8 #include "chrome/browser/guestview/adview/adview_guest.h"
9 #include "chrome/browser/guestview/guestview_constants.h" 9 #include "chrome/browser/guestview/guestview_constants.h"
10 #include "chrome/browser/guestview/webview/webview_guest.h" 10 #include "chrome/browser/guestview/webview/webview_guest.h"
11 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
12 #include "chrome/common/content_settings.h"
12 #include "content/public/browser/render_process_host.h" 13 #include "content/public/browser/render_process_host.h"
13 #include "content/public/browser/web_contents.h" 14 #include "content/public/browser/web_contents.h"
14 #include "content/public/common/url_constants.h" 15 #include "content/public/common/url_constants.h"
15 #include "extensions/browser/event_router.h" 16 #include "extensions/browser/event_router.h"
16 #include "net/base/escape.h" 17 #include "net/base/escape.h"
17 18
18 using content::WebContents; 19 using content::WebContents;
19 20
20 namespace { 21 namespace {
21 22
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 // Since persistence is optional, the path must either be empty or the 112 // Since persistence is optional, the path must either be empty or the
112 // literal string. 113 // literal string.
113 *in_memory = (site.path() != "/persist"); 114 *in_memory = (site.path() != "/persist");
114 // The partition name is user supplied value, which we have encoded when the 115 // The partition name is user supplied value, which we have encoded when the
115 // URL was created, so it needs to be decoded. 116 // URL was created, so it needs to be decoded.
116 *partition_name = net::UnescapeURLComponent(site.query(), 117 *partition_name = net::UnescapeURLComponent(site.query(),
117 net::UnescapeRule::NORMAL); 118 net::UnescapeRule::NORMAL);
118 return true; 119 return true;
119 } 120 }
120 121
122 // static
123 void GuestView::GetDefaultContentSettingRules(
124 RendererContentSettingRules* rules, bool incognito) {
125 rules->image_rules.push_back(ContentSettingPatternSource(
126 ContentSettingsPattern::Wildcard(),
127 ContentSettingsPattern::Wildcard(),
128 CONTENT_SETTING_ALLOW,
129 std::string(),
130 incognito));
131
132 rules->script_rules.push_back(ContentSettingPatternSource(
133 ContentSettingsPattern::Wildcard(),
134 ContentSettingsPattern::Wildcard(),
135 CONTENT_SETTING_ALLOW,
136 std::string(),
137 incognito));
138 }
139
121 void GuestView::Attach(content::WebContents* embedder_web_contents, 140 void GuestView::Attach(content::WebContents* embedder_web_contents,
122 const base::DictionaryValue& args) { 141 const base::DictionaryValue& args) {
123 embedder_web_contents_ = embedder_web_contents; 142 embedder_web_contents_ = embedder_web_contents;
124 embedder_render_process_id_ = 143 embedder_render_process_id_ =
125 embedder_web_contents->GetRenderProcessHost()->GetID(); 144 embedder_web_contents->GetRenderProcessHost()->GetID();
126 args.GetInteger(guestview::kParameterInstanceId, &view_instance_id_); 145 args.GetInteger(guestview::kParameterInstanceId, &view_instance_id_);
127 146
128 std::pair<int, int> key(embedder_render_process_id_, guest_instance_id_); 147 std::pair<int, int> key(embedder_render_process_id_, guest_instance_id_);
129 embedder_guestview_map.Get().insert(std::make_pair(key, this)); 148 embedder_guestview_map.Get().insert(std::make_pair(key, this));
130 149
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 void GuestView::SendQueuedEvents() { 209 void GuestView::SendQueuedEvents() {
191 if (!attached()) 210 if (!attached())
192 return; 211 return;
193 212
194 while (!pending_events_.empty()) { 213 while (!pending_events_.empty()) {
195 Event* event = pending_events_.front(); 214 Event* event = pending_events_.front();
196 pending_events_.pop(); 215 pending_events_.pop();
197 DispatchEvent(event); 216 DispatchEvent(event);
198 } 217 }
199 } 218 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698