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 "content/browser/renderer_host/render_view_host_impl.h" | 5 #include "content/browser/renderer_host/render_view_host_impl.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/callback.h" | 12 #include "base/callback.h" |
13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
14 #include "base/i18n/rtl.h" | 14 #include "base/i18n/rtl.h" |
15 #include "base/json/json_reader.h" | 15 #include "base/json/json_reader.h" |
16 #include "base/json/json_writer.h" | 16 #include "base/json/json_writer.h" |
17 #include "base/message_loop.h" | 17 #include "base/message_loop.h" |
18 #include "base/metrics/histogram.h" | 18 #include "base/metrics/histogram.h" |
19 #include "base/stl_util.h" | 19 #include "base/stl_util.h" |
20 #include "base/string_util.h" | 20 #include "base/string_util.h" |
21 #include "base/time.h" | 21 #include "base/time.h" |
22 #include "base/utf_string_conversions.h" | 22 #include "base/utf_string_conversions.h" |
23 #include "base/values.h" | 23 #include "base/values.h" |
24 #include "content/browser/accessibility/browser_accessibility_state_impl.h" | 24 #include "content/browser/accessibility/browser_accessibility_state_impl.h" |
25 #include "content/browser/child_process_security_policy_impl.h" | 25 #include "content/browser/child_process_security_policy_impl.h" |
26 #include "content/browser/cross_site_request_manager.h" | 26 #include "content/browser/cross_site_request_manager.h" |
27 #include "content/browser/dom_storage/session_storage_namespace_impl.h" | 27 #include "content/browser/dom_storage/session_storage_namespace_impl.h" |
28 #include "content/browser/gpu/gpu_surface_tracker.h" | 28 #include "content/browser/gpu/gpu_surface_tracker.h" |
29 #include "content/browser/host_zoom_map_impl.h" | 29 #include "content/browser/host_zoom_map_impl.h" |
30 #include "content/browser/power_save_blocker.h" | |
31 #include "content/browser/renderer_host/dip_util.h" | 30 #include "content/browser/renderer_host/dip_util.h" |
32 #include "content/browser/renderer_host/render_process_host_impl.h" | 31 #include "content/browser/renderer_host/render_process_host_impl.h" |
33 #include "content/browser/renderer_host/render_view_host_delegate.h" | 32 #include "content/browser/renderer_host/render_view_host_delegate.h" |
34 #include "content/common/accessibility_messages.h" | 33 #include "content/common/accessibility_messages.h" |
35 #include "content/common/browser_plugin_messages.h" | 34 #include "content/common/browser_plugin_messages.h" |
36 #include "content/common/content_constants_internal.h" | 35 #include "content/common/content_constants_internal.h" |
37 #include "content/common/desktop_notification_messages.h" | 36 #include "content/common/desktop_notification_messages.h" |
38 #include "content/common/drag_messages.h" | 37 #include "content/common/drag_messages.h" |
39 #include "content/common/inter_process_time_ticks_converter.h" | 38 #include "content/common/inter_process_time_ticks_converter.h" |
40 #include "content/common/speech_recognition_messages.h" | 39 #include "content/common/speech_recognition_messages.h" |
41 #include "content/common/swapped_out_messages.h" | 40 #include "content/common/swapped_out_messages.h" |
42 #include "content/common/view_messages.h" | 41 #include "content/common/view_messages.h" |
43 #include "content/port/browser/render_view_host_delegate_view.h" | 42 #include "content/port/browser/render_view_host_delegate_view.h" |
44 #include "content/port/browser/render_widget_host_view_port.h" | 43 #include "content/port/browser/render_widget_host_view_port.h" |
45 #include "content/public/browser/browser_accessibility_state.h" | 44 #include "content/public/browser/browser_accessibility_state.h" |
46 #include "content/public/browser/browser_context.h" | 45 #include "content/public/browser/browser_context.h" |
47 #include "content/public/browser/browser_message_filter.h" | 46 #include "content/public/browser/browser_message_filter.h" |
48 #include "content/public/browser/content_browser_client.h" | 47 #include "content/public/browser/content_browser_client.h" |
49 #include "content/public/browser/dom_operation_notification_details.h" | 48 #include "content/public/browser/dom_operation_notification_details.h" |
50 #include "content/public/browser/native_web_keyboard_event.h" | 49 #include "content/public/browser/native_web_keyboard_event.h" |
51 #include "content/public/browser/notification_details.h" | 50 #include "content/public/browser/notification_details.h" |
52 #include "content/public/browser/notification_service.h" | 51 #include "content/public/browser/notification_service.h" |
53 #include "content/public/browser/notification_types.h" | 52 #include "content/public/browser/notification_types.h" |
| 53 #include "content/public/browser/power_save_blocker.h" |
54 #include "content/public/browser/render_view_host_observer.h" | 54 #include "content/public/browser/render_view_host_observer.h" |
55 #include "content/public/browser/user_metrics.h" | 55 #include "content/public/browser/user_metrics.h" |
56 #include "content/public/common/bindings_policy.h" | 56 #include "content/public/common/bindings_policy.h" |
57 #include "content/public/common/content_constants.h" | 57 #include "content/public/common/content_constants.h" |
58 #include "content/public/common/content_switches.h" | 58 #include "content/public/common/content_switches.h" |
59 #include "content/public/common/context_menu_params.h" | 59 #include "content/public/common/context_menu_params.h" |
60 #include "content/public/common/context_menu_source_type.h" | 60 #include "content/public/common/context_menu_source_type.h" |
61 #include "content/public/common/result_codes.h" | 61 #include "content/public/common/result_codes.h" |
62 #include "content/public/common/url_constants.h" | 62 #include "content/public/common/url_constants.h" |
63 #include "net/base/net_util.h" | 63 #include "net/base/net_util.h" |
(...skipping 1898 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1962 host_zoom_map->SetTemporaryZoomLevel( | 1962 host_zoom_map->SetTemporaryZoomLevel( |
1963 GetProcess()->GetID(), GetRoutingID(), zoom_level); | 1963 GetProcess()->GetID(), GetRoutingID(), zoom_level); |
1964 } | 1964 } |
1965 } | 1965 } |
1966 | 1966 |
1967 void RenderViewHostImpl::OnMediaNotification(int64 player_cookie, | 1967 void RenderViewHostImpl::OnMediaNotification(int64 player_cookie, |
1968 bool has_video, | 1968 bool has_video, |
1969 bool has_audio, | 1969 bool has_audio, |
1970 bool is_playing) { | 1970 bool is_playing) { |
1971 if (is_playing) { | 1971 if (is_playing) { |
1972 PowerSaveBlocker* blocker = NULL; | 1972 scoped_ptr<PowerSaveBlocker> blocker; |
1973 if (has_video) { | 1973 if (has_video) { |
1974 blocker = new PowerSaveBlocker( | 1974 blocker = PowerSaveBlocker::Create( |
1975 PowerSaveBlocker::kPowerSaveBlockPreventDisplaySleep, | 1975 PowerSaveBlocker::kPowerSaveBlockPreventDisplaySleep, |
1976 "Playing video"); | 1976 "Playing video"); |
1977 } else if (has_audio) { | 1977 } else if (has_audio) { |
1978 blocker = new PowerSaveBlocker( | 1978 blocker = PowerSaveBlocker::Create( |
1979 PowerSaveBlocker::kPowerSaveBlockPreventAppSuspension, | 1979 PowerSaveBlocker::kPowerSaveBlockPreventAppSuspension, |
1980 "Playing audio"); | 1980 "Playing audio"); |
1981 } | 1981 } |
1982 | 1982 |
1983 if (blocker) | 1983 if (blocker) |
1984 power_save_blockers_[player_cookie] = blocker; | 1984 power_save_blockers_[player_cookie] = blocker.release(); |
1985 } else { | 1985 } else { |
1986 delete power_save_blockers_[player_cookie]; | 1986 delete power_save_blockers_[player_cookie]; |
1987 power_save_blockers_.erase(player_cookie); | 1987 power_save_blockers_.erase(player_cookie); |
1988 } | 1988 } |
1989 } | 1989 } |
1990 | 1990 |
1991 #if defined(OS_ANDROID) | 1991 #if defined(OS_ANDROID) |
1992 void RenderViewHostImpl::OnDidChangeBodyBackgroundColor(SkColor color) { | 1992 void RenderViewHostImpl::OnDidChangeBodyBackgroundColor(SkColor color) { |
1993 if (GetView()) | 1993 if (GetView()) |
1994 GetView()->SetCachedBackgroundColor(color); | 1994 GetView()->SetCachedBackgroundColor(color); |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2094 GetRoutingID(), snapshot_id, snapshot_size, png)); | 2094 GetRoutingID(), snapshot_id, snapshot_size, png)); |
2095 return; | 2095 return; |
2096 } | 2096 } |
2097 } | 2097 } |
2098 | 2098 |
2099 Send(new ViewMsg_WindowSnapshotCompleted( | 2099 Send(new ViewMsg_WindowSnapshotCompleted( |
2100 GetRoutingID(), snapshot_id, gfx::Size(), png)); | 2100 GetRoutingID(), snapshot_id, gfx::Size(), png)); |
2101 } | 2101 } |
2102 | 2102 |
2103 } // namespace content | 2103 } // namespace content |
OLD | NEW |