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

Side by Side Diff: extensions/browser/guest_view/web_view/web_view_guest.cc

Issue 1312653003: Fix for WebView accessible resources. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments by kalman@. Created 5 years, 3 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 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 "extensions/browser/guest_view/web_view/web_view_guest.h" 5 #include "extensions/browser/guest_view/web_view/web_view_guest.h"
6 6
7 #include "base/message_loop/message_loop.h" 7 #include "base/message_loop/message_loop.h"
8 #include "base/strings/stringprintf.h" 8 #include "base/strings/stringprintf.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "components/browsing_data/storage_partition_http_cache_data_remover.h" 10 #include "components/browsing_data/storage_partition_http_cache_data_remover.h"
(...skipping 30 matching lines...) Expand all
41 #include "extensions/browser/api/web_request/web_request_api.h" 41 #include "extensions/browser/api/web_request/web_request_api.h"
42 #include "extensions/browser/extension_system.h" 42 #include "extensions/browser/extension_system.h"
43 #include "extensions/browser/extensions_browser_client.h" 43 #include "extensions/browser/extensions_browser_client.h"
44 #include "extensions/browser/guest_view/web_view/web_view_constants.h" 44 #include "extensions/browser/guest_view/web_view/web_view_constants.h"
45 #include "extensions/browser/guest_view/web_view/web_view_content_script_manager .h" 45 #include "extensions/browser/guest_view/web_view/web_view_content_script_manager .h"
46 #include "extensions/browser/guest_view/web_view/web_view_permission_helper.h" 46 #include "extensions/browser/guest_view/web_view/web_view_permission_helper.h"
47 #include "extensions/browser/guest_view/web_view/web_view_permission_types.h" 47 #include "extensions/browser/guest_view/web_view/web_view_permission_types.h"
48 #include "extensions/browser/guest_view/web_view/web_view_renderer_state.h" 48 #include "extensions/browser/guest_view/web_view/web_view_renderer_state.h"
49 #include "extensions/common/constants.h" 49 #include "extensions/common/constants.h"
50 #include "extensions/common/extension_messages.h" 50 #include "extensions/common/extension_messages.h"
51 #include "extensions/common/manifest_constants.h"
51 #include "extensions/strings/grit/extensions_strings.h" 52 #include "extensions/strings/grit/extensions_strings.h"
52 #include "ipc/ipc_message_macros.h" 53 #include "ipc/ipc_message_macros.h"
53 #include "net/base/escape.h" 54 #include "net/base/escape.h"
54 #include "net/base/net_errors.h" 55 #include "net/base/net_errors.h"
55 #include "ui/base/models/simple_menu_model.h" 56 #include "ui/base/models/simple_menu_model.h"
56 #include "url/url_constants.h" 57 #include "url/url_constants.h"
57 58
58 using base::UserMetricsAction; 59 using base::UserMetricsAction;
59 using content::GlobalRequestID; 60 using content::GlobalRequestID;
60 using content::RenderFrameHost; 61 using content::RenderFrameHost;
62 using content::RenderProcessHost;
61 using content::ResourceType; 63 using content::ResourceType;
62 using content::StoragePartition; 64 using content::StoragePartition;
63 using content::WebContents; 65 using content::WebContents;
64 using guest_view::GuestViewBase; 66 using guest_view::GuestViewBase;
65 using guest_view::GuestViewEvent; 67 using guest_view::GuestViewEvent;
66 using guest_view::GuestViewManager; 68 using guest_view::GuestViewManager;
67 using ui_zoom::ZoomController; 69 using ui_zoom::ZoomController;
68 70
69 namespace extensions { 71 namespace extensions {
70 72
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 // literal string. 259 // literal string.
258 *in_memory = (site.path() != "/persist"); 260 *in_memory = (site.path() != "/persist");
259 // The partition name is user supplied value, which we have encoded when the 261 // The partition name is user supplied value, which we have encoded when the
260 // URL was created, so it needs to be decoded. 262 // URL was created, so it needs to be decoded.
261 *partition_name = 263 *partition_name =
262 net::UnescapeURLComponent(site.query(), net::UnescapeRule::NORMAL); 264 net::UnescapeURLComponent(site.query(), net::UnescapeRule::NORMAL);
263 return true; 265 return true;
264 } 266 }
265 267
266 // static 268 // static
269 std::string WebViewGuest::GetPartitionID(
270 const RenderProcessHost* render_process_host) {
271 WebViewRendererState* renderer_state = WebViewRendererState::GetInstance();
272 int process_id = render_process_host->GetID();
273 std::string partition_id;
274 if (renderer_state->IsGuest(process_id))
275 renderer_state->GetPartitionID(process_id, &partition_id);
not at google - send to devlin 2015/08/31 18:31:44 There is a threading mismatch here. WebViewRendere
paulmeyer 2015/08/31 21:40:08 You may have been looking at an out-of-date versio
not at google - send to devlin 2015/08/31 21:52:51 I'm not looking at an old version, I'm looking at
paulmeyer 2015/09/02 13:43:57 Oh, I see. Those comments are stale, so I'll remov
276
277 return partition_id;
278 }
279
280 // static
267 const char WebViewGuest::Type[] = "webview"; 281 const char WebViewGuest::Type[] = "webview";
268 282
269 // static 283 // static
270 int WebViewGuest::GetOrGenerateRulesRegistryID( 284 int WebViewGuest::GetOrGenerateRulesRegistryID(
271 int embedder_process_id, 285 int embedder_process_id,
272 int webview_instance_id) { 286 int webview_instance_id) {
273 bool is_web_view = embedder_process_id && webview_instance_id; 287 bool is_web_view = embedder_process_id && webview_instance_id;
274 if (!is_web_view) 288 if (!is_web_view)
275 return RulesRegistryService::kDefaultRulesRegistryID; 289 return RulesRegistryService::kDefaultRulesRegistryID;
276 290
(...skipping 1184 matching lines...) Expand 10 before | Expand all | Expand 10 after
1461 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue()); 1475 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue());
1462 DispatchEventToView( 1476 DispatchEventToView(
1463 new GuestViewEvent(webview::kEventExitFullscreen, args.Pass())); 1477 new GuestViewEvent(webview::kEventExitFullscreen, args.Pass()));
1464 } 1478 }
1465 // Since we changed fullscreen state, sending a Resize message ensures that 1479 // Since we changed fullscreen state, sending a Resize message ensures that
1466 // renderer/ sees the change. 1480 // renderer/ sees the change.
1467 web_contents()->GetRenderViewHost()->WasResized(); 1481 web_contents()->GetRenderViewHost()->WasResized();
1468 } 1482 }
1469 1483
1470 } // namespace extensions 1484 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698