OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "content/renderer/render_view.h" | 5 #include "content/renderer/render_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 22 matching lines...) Expand all Loading... |
33 #include "chrome/common/render_messages.h" | 33 #include "chrome/common/render_messages.h" |
34 #include "chrome/common/render_view_commands.h" | 34 #include "chrome/common/render_view_commands.h" |
35 #include "chrome/common/thumbnail_score.h" | 35 #include "chrome/common/thumbnail_score.h" |
36 #include "chrome/common/url_constants.h" | 36 #include "chrome/common/url_constants.h" |
37 #include "chrome/common/web_apps.h" | 37 #include "chrome/common/web_apps.h" |
38 #include "chrome/renderer/about_handler.h" | 38 #include "chrome/renderer/about_handler.h" |
39 #include "chrome/renderer/automation/dom_automation_controller.h" | 39 #include "chrome/renderer/automation/dom_automation_controller.h" |
40 #include "chrome/renderer/external_host_bindings.h" | 40 #include "chrome/renderer/external_host_bindings.h" |
41 #include "chrome/renderer/localized_error.h" | 41 #include "chrome/renderer/localized_error.h" |
42 #include "chrome/renderer/page_load_histograms.h" | 42 #include "chrome/renderer/page_load_histograms.h" |
43 #include "chrome/renderer/print_web_view_helper.h" | |
44 #include "chrome/renderer/render_process.h" | 43 #include "chrome/renderer/render_process.h" |
45 #include "chrome/renderer/render_thread.h" | 44 #include "chrome/renderer/render_thread.h" |
46 #include "chrome/renderer/searchbox.h" | 45 #include "chrome/renderer/searchbox.h" |
47 #include "chrome/renderer/spellchecker/spellcheck.h" | 46 #include "chrome/renderer/spellchecker/spellcheck.h" |
48 #include "chrome/renderer/spellchecker/spellcheck_provider.h" | 47 #include "chrome/renderer/spellchecker/spellcheck_provider.h" |
49 #include "chrome/renderer/translate_helper.h" | 48 #include "chrome/renderer/translate_helper.h" |
50 #include "chrome/renderer/visitedlink_slave.h" | 49 #include "chrome/renderer/visitedlink_slave.h" |
51 #include "content/common/appcache/appcache_dispatcher.h" | 50 #include "content/common/appcache/appcache_dispatcher.h" |
52 #include "content/common/clipboard_messages.h" | 51 #include "content/common/clipboard_messages.h" |
53 #include "content/common/content_constants.h" | 52 #include "content/common/content_constants.h" |
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 target_url_status_(TARGET_NONE), | 490 target_url_status_(TARGET_NONE), |
492 view_type_(ViewType::INVALID), | 491 view_type_(ViewType::INVALID), |
493 browser_window_id_(-1), | 492 browser_window_id_(-1), |
494 ALLOW_THIS_IN_INITIALIZER_LIST(pepper_delegate_(this)), | 493 ALLOW_THIS_IN_INITIALIZER_LIST(pepper_delegate_(this)), |
495 ALLOW_THIS_IN_INITIALIZER_LIST(page_info_method_factory_(this)), | 494 ALLOW_THIS_IN_INITIALIZER_LIST(page_info_method_factory_(this)), |
496 ALLOW_THIS_IN_INITIALIZER_LIST(accessibility_method_factory_(this)), | 495 ALLOW_THIS_IN_INITIALIZER_LIST(accessibility_method_factory_(this)), |
497 ALLOW_THIS_IN_INITIALIZER_LIST(cookie_jar_(this)), | 496 ALLOW_THIS_IN_INITIALIZER_LIST(cookie_jar_(this)), |
498 geolocation_dispatcher_(NULL), | 497 geolocation_dispatcher_(NULL), |
499 speech_input_dispatcher_(NULL), | 498 speech_input_dispatcher_(NULL), |
500 device_orientation_dispatcher_(NULL), | 499 device_orientation_dispatcher_(NULL), |
501 print_helper_(NULL), | |
502 searchbox_(NULL), | |
503 spellcheck_provider_(NULL), | 500 spellcheck_provider_(NULL), |
504 accessibility_ack_pending_(false), | 501 accessibility_ack_pending_(false), |
505 p2p_socket_dispatcher_(NULL), | 502 p2p_socket_dispatcher_(NULL), |
506 pending_app_icon_requests_(0), | 503 pending_app_icon_requests_(0), |
507 session_storage_namespace_id_(session_storage_namespace_id) { | 504 session_storage_namespace_id_(session_storage_namespace_id) { |
508 | 505 |
509 ClearBlockedContentSettings(); | 506 ClearBlockedContentSettings(); |
510 | 507 |
511 routing_id_ = routing_id; | 508 routing_id_ = routing_id; |
512 if (opener_id != MSG_ROUTING_NONE) | 509 if (opener_id != MSG_ROUTING_NONE) |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
552 | 549 |
553 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 550 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
554 if (command_line.HasSwitch(switches::kDomAutomationController)) | 551 if (command_line.HasSwitch(switches::kDomAutomationController)) |
555 enabled_bindings_ |= BindingsPolicy::DOM_AUTOMATION; | 552 enabled_bindings_ |= BindingsPolicy::DOM_AUTOMATION; |
556 if (command_line.HasSwitch(switches::kEnableAccessibility)) | 553 if (command_line.HasSwitch(switches::kEnableAccessibility)) |
557 WebAccessibilityCache::enableAccessibility(); | 554 WebAccessibilityCache::enableAccessibility(); |
558 | 555 |
559 audio_message_filter_ = new AudioMessageFilter(routing_id_); | 556 audio_message_filter_ = new AudioMessageFilter(routing_id_); |
560 render_thread_->AddFilter(audio_message_filter_); | 557 render_thread_->AddFilter(audio_message_filter_); |
561 | 558 |
562 print_helper_ = new PrintWebViewHelper(this); | |
563 searchbox_ = new SearchBox(this); | |
564 | |
565 RenderThread* current_thread = RenderThread::current(); | 559 RenderThread* current_thread = RenderThread::current(); |
566 SpellCheck* spellcheck = current_thread ? current_thread->spellchecker() : 0; | 560 SpellCheck* spellcheck = current_thread ? current_thread->spellchecker() : 0; |
567 spellcheck_provider_ = new SpellCheckProvider(this, spellcheck); | 561 spellcheck_provider_ = new SpellCheckProvider(this, spellcheck); |
568 webview()->setSpellCheckClient(spellcheck_provider_); | 562 webview()->setSpellCheckClient(spellcheck_provider_); |
569 | 563 |
570 if (CommandLine::ForCurrentProcess()->HasSwitch( | 564 if (CommandLine::ForCurrentProcess()->HasSwitch( |
571 switches::kEnableP2PApi)) { | 565 switches::kEnableP2PApi)) { |
572 p2p_socket_dispatcher_ = new P2PSocketDispatcher(this); | 566 p2p_socket_dispatcher_ = new P2PSocketDispatcher(this); |
573 } | 567 } |
574 | 568 |
(...skipping 1357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1932 DCHECK(!external_popup_menu_.get()); | 1926 DCHECK(!external_popup_menu_.get()); |
1933 external_popup_menu_.reset( | 1927 external_popup_menu_.reset( |
1934 new ExternalPopupMenu(this, popup_menu_info, popup_menu_client)); | 1928 new ExternalPopupMenu(this, popup_menu_info, popup_menu_client)); |
1935 return external_popup_menu_.get(); | 1929 return external_popup_menu_.get(); |
1936 } | 1930 } |
1937 | 1931 |
1938 webkit::ppapi::FullscreenContainer* | 1932 webkit::ppapi::FullscreenContainer* |
1939 RenderView::CreatePepperFullscreenContainer( | 1933 RenderView::CreatePepperFullscreenContainer( |
1940 webkit::ppapi::PluginInstance* plugin) { | 1934 webkit::ppapi::PluginInstance* plugin) { |
1941 GURL active_url; | 1935 GURL active_url; |
1942 if(webview() && webview()->mainFrame()) | 1936 if (webview() && webview()->mainFrame()) |
1943 active_url = GURL(webview()->mainFrame()->url()); | 1937 active_url = GURL(webview()->mainFrame()->url()); |
1944 RenderWidgetFullscreenPepper* widget = RenderWidgetFullscreenPepper::Create( | 1938 RenderWidgetFullscreenPepper* widget = RenderWidgetFullscreenPepper::Create( |
1945 routing_id_, render_thread_, plugin, active_url); | 1939 routing_id_, render_thread_, plugin, active_url); |
1946 widget->show(WebKit::WebNavigationPolicyIgnore); | 1940 widget->show(WebKit::WebNavigationPolicyIgnore); |
1947 return widget; | 1941 return widget; |
1948 } | 1942 } |
1949 | 1943 |
1950 WebStorageNamespace* RenderView::createSessionStorageNamespace(unsigned quota) { | 1944 WebStorageNamespace* RenderView::createSessionStorageNamespace(unsigned quota) { |
1951 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess)) | 1945 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess)) |
1952 return WebStorageNamespace::createSessionStorageNamespace(quota); | 1946 return WebStorageNamespace::createSessionStorageNamespace(quota); |
1953 CHECK(session_storage_namespace_id_ != kInvalidSessionStorageNamespaceId); | 1947 CHECK(session_storage_namespace_id_ != kInvalidSessionStorageNamespaceId); |
1954 return new RendererWebStorageNamespaceImpl(DOM_STORAGE_SESSION, | 1948 return new RendererWebStorageNamespaceImpl(DOM_STORAGE_SESSION, |
1955 session_storage_namespace_id_); | 1949 session_storage_namespace_id_); |
1956 } | 1950 } |
1957 | 1951 |
1958 void RenderView::didAddMessageToConsole( | 1952 void RenderView::didAddMessageToConsole( |
1959 const WebConsoleMessage& message, const WebString& source_name, | 1953 const WebConsoleMessage& message, const WebString& source_name, |
1960 unsigned source_line) { | 1954 unsigned source_line) { |
1961 Send(new ViewHostMsg_AddMessageToConsole(routing_id_, | 1955 Send(new ViewHostMsg_AddMessageToConsole(routing_id_, |
1962 UTF16ToWideHack(message.text), | 1956 UTF16ToWideHack(message.text), |
1963 static_cast<int32>(source_line), | 1957 static_cast<int32>(source_line), |
1964 UTF16ToWideHack(source_name))); | 1958 UTF16ToWideHack(source_name))); |
1965 } | 1959 } |
1966 | 1960 |
1967 void RenderView::printPage(WebFrame* frame) { | 1961 void RenderView::printPage(WebFrame* frame) { |
1968 print_helper_->ScriptInitiatedPrint(frame); | 1962 FOR_EACH_OBSERVER(RenderViewObserver, observers_, PrintPage(frame)); |
1969 } | 1963 } |
1970 | 1964 |
1971 WebKit::WebNotificationPresenter* RenderView::notificationPresenter() { | 1965 WebKit::WebNotificationPresenter* RenderView::notificationPresenter() { |
1972 return notification_provider_; | 1966 return notification_provider_; |
1973 } | 1967 } |
1974 | 1968 |
1975 void RenderView::didStartLoading() { | 1969 void RenderView::didStartLoading() { |
1976 if (is_loading_) { | 1970 if (is_loading_) { |
1977 DLOG(WARNING) << "didStartLoading called while loading"; | 1971 DLOG(WARNING) << "didStartLoading called while loading"; |
1978 return; | 1972 return; |
(...skipping 3064 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5043 const webkit_glue::CustomContextMenuContext& custom_context) { | 5037 const webkit_glue::CustomContextMenuContext& custom_context) { |
5044 if (custom_context.is_pepper_menu) | 5038 if (custom_context.is_pepper_menu) |
5045 pepper_delegate_.OnContextMenuClosed(custom_context); | 5039 pepper_delegate_.OnContextMenuClosed(custom_context); |
5046 else | 5040 else |
5047 context_menu_node_.reset(); | 5041 context_menu_node_.reset(); |
5048 } | 5042 } |
5049 | 5043 |
5050 void RenderView::OnNetworkStateChanged(bool online) { | 5044 void RenderView::OnNetworkStateChanged(bool online) { |
5051 WebNetworkStateNotifier::setOnLine(online); | 5045 WebNetworkStateNotifier::setOnLine(online); |
5052 } | 5046 } |
OLD | NEW |