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_process_observer.h" | 5 #include "chrome/renderer/chrome_render_process_observer.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/allocator/allocator_extension.h" | 10 #include "base/allocator/allocator_extension.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 #include "chrome/common/net/net_resource_provider.h" | 27 #include "chrome/common/net/net_resource_provider.h" |
28 #include "chrome/common/render_messages.h" | 28 #include "chrome/common/render_messages.h" |
29 #include "chrome/common/resource_usage_reporter.mojom.h" | 29 #include "chrome/common/resource_usage_reporter.mojom.h" |
30 #include "chrome/common/resource_usage_reporter_type_converters.h" | 30 #include "chrome/common/resource_usage_reporter_type_converters.h" |
31 #include "chrome/common/url_constants.h" | 31 #include "chrome/common/url_constants.h" |
32 #include "chrome/renderer/content_settings_observer.h" | 32 #include "chrome/renderer/content_settings_observer.h" |
33 #include "chrome/renderer/security_filter_peer.h" | 33 #include "chrome/renderer/security_filter_peer.h" |
34 #include "components/variations/variations_util.h" | 34 #include "components/variations/variations_util.h" |
35 #include "content/public/child/resource_dispatcher_delegate.h" | 35 #include "content/public/child/resource_dispatcher_delegate.h" |
36 #include "content/public/common/service_registry.h" | 36 #include "content/public/common/service_registry.h" |
| 37 #include "content/public/renderer/render_frame.h" |
37 #include "content/public/renderer/render_thread.h" | 38 #include "content/public/renderer/render_thread.h" |
38 #include "content/public/renderer/render_view.h" | |
39 #include "content/public/renderer/render_view_visitor.h" | |
40 #include "net/base/net_errors.h" | 39 #include "net/base/net_errors.h" |
41 #include "net/base/net_module.h" | 40 #include "net/base/net_module.h" |
42 #include "third_party/WebKit/public/web/WebCache.h" | 41 #include "third_party/WebKit/public/web/WebCache.h" |
43 #include "third_party/WebKit/public/web/WebDocument.h" | 42 #include "third_party/WebKit/public/web/WebDocument.h" |
44 #include "third_party/WebKit/public/web/WebFrame.h" | 43 #include "third_party/WebKit/public/web/WebFrame.h" |
| 44 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
45 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" | 45 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" |
46 #include "third_party/WebKit/public/web/WebSecurityPolicy.h" | 46 #include "third_party/WebKit/public/web/WebSecurityPolicy.h" |
47 #include "third_party/WebKit/public/web/WebView.h" | 47 #include "third_party/WebKit/public/web/WebView.h" |
48 #include "third_party/mojo/src/mojo/public/cpp/bindings/strong_binding.h" | 48 #include "third_party/mojo/src/mojo/public/cpp/bindings/strong_binding.h" |
49 | 49 |
50 #if defined(ENABLE_EXTENSIONS) | 50 #if defined(ENABLE_EXTENSIONS) |
51 #include "chrome/renderer/extensions/extension_localization_peer.h" | 51 #include "chrome/renderer/extensions/extension_localization_peer.h" |
52 #endif | 52 #endif |
53 | 53 |
54 #if !defined(OS_IOS) | 54 #if !defined(OS_IOS) |
(...skipping 26 matching lines...) Expand all Loading... |
81 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( | 81 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
82 FROM_HERE, | 82 FROM_HERE, |
83 base::Bind(&RendererResourceDelegate::InformHostOfCacheStats, | 83 base::Bind(&RendererResourceDelegate::InformHostOfCacheStats, |
84 weak_factory_.GetWeakPtr()), | 84 weak_factory_.GetWeakPtr()), |
85 base::TimeDelta::FromMilliseconds(kCacheStatsDelayMS)); | 85 base::TimeDelta::FromMilliseconds(kCacheStatsDelayMS)); |
86 } | 86 } |
87 | 87 |
88 if (error_code == net::ERR_ABORTED) { | 88 if (error_code == net::ERR_ABORTED) { |
89 return NULL; | 89 return NULL; |
90 } | 90 } |
| 91 if (resource_type == content::RESOURCE_TYPE_MAIN_FRAME) { |
| 92 blink::WebFrame* web_frame = |
| 93 blink::WebLocalFrame::frameForCurrentContext(); |
| 94 content::RenderFrame* render_frame = nullptr; |
| 95 if (web_frame != nullptr) |
| 96 render_frame = content::RenderFrame::FromWebFrame(web_frame); |
| 97 DLOG(WARNING) << "Got frames " << (web_frame != nullptr) << " & " |
| 98 << (render_frame != nullptr); |
| 99 // Investigate |
| 100 } |
91 | 101 |
92 // Resource canceled with a specific error are filtered. | 102 // Resource canceled with a specific error are filtered. |
93 return SecurityFilterPeer::CreateSecurityFilterPeerForDeniedRequest( | 103 return SecurityFilterPeer::CreateSecurityFilterPeerForDeniedRequest( |
94 resource_type, current_peer, error_code); | 104 resource_type, current_peer, error_code); |
95 } | 105 } |
96 | 106 |
97 content::RequestPeer* OnReceivedResponse(content::RequestPeer* current_peer, | 107 content::RequestPeer* OnReceivedResponse(content::RequestPeer* current_peer, |
98 const std::string& mime_type, | 108 const std::string& mime_type, |
99 const GURL& url) override { | 109 const GURL& url) override { |
100 #if defined(ENABLE_EXTENSIONS) | 110 #if defined(ENABLE_EXTENSIONS) |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 ChromeRenderProcessObserver::content_setting_rules() const { | 340 ChromeRenderProcessObserver::content_setting_rules() const { |
331 return &content_setting_rules_; | 341 return &content_setting_rules_; |
332 } | 342 } |
333 | 343 |
334 void ChromeRenderProcessObserver::OnFieldTrialGroupFinalized( | 344 void ChromeRenderProcessObserver::OnFieldTrialGroupFinalized( |
335 const std::string& trial_name, | 345 const std::string& trial_name, |
336 const std::string& group_name) { | 346 const std::string& group_name) { |
337 content::RenderThread::Get()->Send( | 347 content::RenderThread::Get()->Send( |
338 new ChromeViewHostMsg_FieldTrialActivated(trial_name)); | 348 new ChromeViewHostMsg_FieldTrialActivated(trial_name)); |
339 } | 349 } |
OLD | NEW |