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

Side by Side Diff: chrome/renderer/chrome_render_view_observer.cc

Issue 10928188: Enable web components for shell windows based on their render view type, rather than their origin. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/renderer/chrome_render_view_observer.h" 5 #include "chrome/renderer/chrome_render_view_observer.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
11 #include "base/message_loop.h" 11 #include "base/message_loop.h"
12 #include "base/metrics/histogram.h" 12 #include "base/metrics/histogram.h"
13 #include "base/string_util.h" 13 #include "base/string_util.h"
14 #include "chrome/common/chrome_constants.h" 14 #include "chrome/common/chrome_constants.h"
15 #include "chrome/common/chrome_switches.h" 15 #include "chrome/common/chrome_switches.h"
16 #include "chrome/common/icon_messages.h" 16 #include "chrome/common/icon_messages.h"
17 #include "chrome/common/prerender_messages.h" 17 #include "chrome/common/prerender_messages.h"
18 #include "chrome/common/render_messages.h" 18 #include "chrome/common/render_messages.h"
19 #include "chrome/common/thumbnail_score.h" 19 #include "chrome/common/thumbnail_score.h"
20 #include "chrome/common/thumbnail_support.h" 20 #include "chrome/common/thumbnail_support.h"
21 #include "chrome/common/url_constants.h" 21 #include "chrome/common/url_constants.h"
22 #include "chrome/renderer/chrome_render_process_observer.h" 22 #include "chrome/renderer/chrome_render_process_observer.h"
23 #include "chrome/renderer/content_settings_observer.h" 23 #include "chrome/renderer/content_settings_observer.h"
24 #include "chrome/renderer/extensions/dispatcher.h" 24 #include "chrome/renderer/extensions/dispatcher.h"
25 #include "chrome/renderer/extensions/extension_helper.h"
25 #include "chrome/renderer/external_host_bindings.h" 26 #include "chrome/renderer/external_host_bindings.h"
26 #include "chrome/renderer/frame_sniffer.h" 27 #include "chrome/renderer/frame_sniffer.h"
27 #include "chrome/renderer/prerender/prerender_helper.h" 28 #include "chrome/renderer/prerender/prerender_helper.h"
28 #include "chrome/renderer/safe_browsing/phishing_classifier_delegate.h" 29 #include "chrome/renderer/safe_browsing/phishing_classifier_delegate.h"
29 #include "chrome/renderer/translate_helper.h" 30 #include "chrome/renderer/translate_helper.h"
30 #include "chrome/renderer/webview_animating_overlay.h" 31 #include "chrome/renderer/webview_animating_overlay.h"
31 #include "chrome/renderer/webview_color_overlay.h" 32 #include "chrome/renderer/webview_color_overlay.h"
32 #include "content/public/common/bindings_policy.h" 33 #include "content/public/common/bindings_policy.h"
33 #include "content/public/renderer/render_view.h" 34 #include "content/public/renderer/render_view.h"
34 #include "content/public/renderer/content_renderer_client.h" 35 #include "content/public/renderer/content_renderer_client.h"
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 // Titlebars in app windows are implmented via Shadow DOM. 524 // Titlebars in app windows are implmented via Shadow DOM.
524 if (extension->HasAPIPermission(APIPermission::kAppWindow)) 525 if (extension->HasAPIPermission(APIPermission::kAppWindow))
525 return true; 526 return true;
526 527
527 // The <browser> tag is implemented via Shadow DOM. 528 // The <browser> tag is implemented via Shadow DOM.
528 if (extension->HasAPIPermission(APIPermission::kBrowserTag)) 529 if (extension->HasAPIPermission(APIPermission::kBrowserTag))
529 return true; 530 return true;
530 531
531 if (extension->HasAPIPermission(APIPermission::kExperimental)) 532 if (extension->HasAPIPermission(APIPermission::kExperimental))
532 return true; 533 return true;
534 } else {
535 // XXX perhaps we should only use this check, and remove the above checks?
Mihai Parparita -not on Chrome 2012/09/13 20:17:36 I'd rather keep the permission-based checks where
536 extensions::ExtensionHelper* helper =
537 extensions::ExtensionHelper::Get(render_view());
538 // XXX is there always an ExtensionHelper for every RenderView?
Mihai Parparita -not on Chrome 2012/09/13 20:17:36 Yes. We create one as soon as the RenderView is cr
539 // chrome/renderer/chrome_content_renderer_client.cc seems to make this
540 // assumption...
541 if (helper->view_type() == chrome::VIEW_TYPE_APP_SHELL)
542 return true;
533 } 543 }
534 544
535 return false; 545 return false;
536 } 546 }
537 547
538 bool ChromeRenderViewObserver::allowHTMLNotifications( 548 bool ChromeRenderViewObserver::allowHTMLNotifications(
539 const WebDocument& document) { 549 const WebDocument& document) {
540 WebSecurityOrigin origin = document.securityOrigin(); 550 WebSecurityOrigin origin = document.securityOrigin();
541 const extensions::Extension* extension = GetExtension(origin); 551 const extensions::Extension* extension = GetExtension(origin);
542 return extension && extension->HasAPIPermission(APIPermission::kNotification); 552 return extension && extension->HasAPIPermission(APIPermission::kNotification);
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after
1118 reinterpret_cast<const unsigned char*>(&data[0]); 1128 reinterpret_cast<const unsigned char*>(&data[0]);
1119 1129
1120 return decoder.Decode(src_data, data.size()); 1130 return decoder.Decode(src_data, data.size());
1121 } 1131 }
1122 return SkBitmap(); 1132 return SkBitmap();
1123 } 1133 }
1124 1134
1125 bool ChromeRenderViewObserver::IsStrictSecurityHost(const std::string& host) { 1135 bool ChromeRenderViewObserver::IsStrictSecurityHost(const std::string& host) {
1126 return (strict_security_hosts_.find(host) != strict_security_hosts_.end()); 1136 return (strict_security_hosts_.find(host) != strict_security_hosts_.end());
1127 } 1137 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698