| OLD | NEW |
| 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 Loading... |
| 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 // When a packaged app opens a window with a sandboxed resource, the origin |
| 536 // will be unique (i.e. the empty string), so the fact that it is a shell |
| 537 // window must be deduced from the view type instead to enable web |
| 538 // components for HTML titlebars. |
| 539 extensions::ExtensionHelper* helper = |
| 540 extensions::ExtensionHelper::Get(render_view()); |
| 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 Loading... |
| 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 } |
| OLD | NEW |