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_thread_observer.h" | 5 #include "chrome/renderer/chrome_render_thread_observer.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <limits> | 9 #include <limits> |
10 #include <memory> | 10 #include <memory> |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 #include "content/public/renderer/render_thread.h" | 44 #include "content/public/renderer/render_thread.h" |
45 #include "content/public/renderer/render_view.h" | 45 #include "content/public/renderer/render_view.h" |
46 #include "content/public/renderer/render_view_visitor.h" | 46 #include "content/public/renderer/render_view_visitor.h" |
47 #include "media/base/media_resources.h" | 47 #include "media/base/media_resources.h" |
48 #include "mojo/public/cpp/bindings/strong_binding.h" | 48 #include "mojo/public/cpp/bindings/strong_binding.h" |
49 #include "net/base/net_errors.h" | 49 #include "net/base/net_errors.h" |
50 #include "net/base/net_module.h" | 50 #include "net/base/net_module.h" |
51 #include "third_party/WebKit/public/web/WebCache.h" | 51 #include "third_party/WebKit/public/web/WebCache.h" |
52 #include "third_party/WebKit/public/web/WebDocument.h" | 52 #include "third_party/WebKit/public/web/WebDocument.h" |
53 #include "third_party/WebKit/public/web/WebFrame.h" | 53 #include "third_party/WebKit/public/web/WebFrame.h" |
54 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" | |
55 #include "third_party/WebKit/public/web/WebSecurityPolicy.h" | 54 #include "third_party/WebKit/public/web/WebSecurityPolicy.h" |
56 #include "third_party/WebKit/public/web/WebView.h" | 55 #include "third_party/WebKit/public/web/WebView.h" |
57 | 56 |
58 #if defined(ENABLE_EXTENSIONS) | 57 #if defined(ENABLE_EXTENSIONS) |
59 #include "chrome/renderer/extensions/extension_localization_peer.h" | 58 #include "chrome/renderer/extensions/extension_localization_peer.h" |
60 #endif | 59 #endif |
61 | 60 |
62 using blink::WebCache; | 61 using blink::WebCache; |
63 using blink::WebRuntimeFeatures; | |
64 using blink::WebSecurityPolicy; | 62 using blink::WebSecurityPolicy; |
65 using blink::WebString; | 63 using blink::WebString; |
66 using content::RenderThread; | 64 using content::RenderThread; |
67 | 65 |
68 namespace { | 66 namespace { |
69 | 67 |
70 const int kCacheStatsDelayMS = 2000; | 68 const int kCacheStatsDelayMS = 2000; |
71 | 69 |
72 class RendererResourceDelegate : public content::ResourceDispatcherDelegate { | 70 class RendererResourceDelegate : public content::ResourceDispatcherDelegate { |
73 public: | 71 public: |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 | 235 |
238 } // namespace | 236 } // namespace |
239 | 237 |
240 bool ChromeRenderThreadObserver::is_incognito_process_ = false; | 238 bool ChromeRenderThreadObserver::is_incognito_process_ = false; |
241 | 239 |
242 ChromeRenderThreadObserver::ChromeRenderThreadObserver() | 240 ChromeRenderThreadObserver::ChromeRenderThreadObserver() |
243 : weak_factory_(this) { | 241 : weak_factory_(this) { |
244 const base::CommandLine& command_line = | 242 const base::CommandLine& command_line = |
245 *base::CommandLine::ForCurrentProcess(); | 243 *base::CommandLine::ForCurrentProcess(); |
246 | 244 |
247 #if defined(ENABLE_AUTOFILL_DIALOG) | |
248 WebRuntimeFeatures::enableRequestAutocomplete(true); | |
249 #endif | |
250 | |
251 RenderThread* thread = RenderThread::Get(); | 245 RenderThread* thread = RenderThread::Get(); |
252 resource_delegate_.reset(new RendererResourceDelegate()); | 246 resource_delegate_.reset(new RendererResourceDelegate()); |
253 thread->SetResourceDispatcherDelegate(resource_delegate_.get()); | 247 thread->SetResourceDispatcherDelegate(resource_delegate_.get()); |
254 | 248 |
255 thread->GetServiceRegistry()->AddService( | 249 thread->GetServiceRegistry()->AddService( |
256 base::Bind(CreateResourceUsageReporter, weak_factory_.GetWeakPtr())); | 250 base::Bind(CreateResourceUsageReporter, weak_factory_.GetWeakPtr())); |
257 | 251 |
258 // Configure modules that need access to resources. | 252 // Configure modules that need access to resources. |
259 net::NetModule::SetResourceProvider(chrome_common_net::NetResourceProvider); | 253 net::NetModule::SetResourceProvider(chrome_common_net::NetResourceProvider); |
260 media::SetLocalizedStringProvider( | 254 media::SetLocalizedStringProvider( |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 ChromeRenderThreadObserver::content_setting_rules() const { | 364 ChromeRenderThreadObserver::content_setting_rules() const { |
371 return &content_setting_rules_; | 365 return &content_setting_rules_; |
372 } | 366 } |
373 | 367 |
374 void ChromeRenderThreadObserver::OnFieldTrialGroupFinalized( | 368 void ChromeRenderThreadObserver::OnFieldTrialGroupFinalized( |
375 const std::string& trial_name, | 369 const std::string& trial_name, |
376 const std::string& group_name) { | 370 const std::string& group_name) { |
377 content::RenderThread::Get()->Send( | 371 content::RenderThread::Get()->Send( |
378 new ChromeViewHostMsg_FieldTrialActivated(trial_name)); | 372 new ChromeViewHostMsg_FieldTrialActivated(trial_name)); |
379 } | 373 } |
OLD | NEW |