| 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/web_contents/web_contents_impl.h" | 5 #include "content/browser/web_contents/web_contents_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <cmath> | 9 #include <cmath> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 render_frame_message_source_(NULL), | 351 render_frame_message_source_(NULL), |
| 352 fullscreen_widget_routing_id_(MSG_ROUTING_NONE), | 352 fullscreen_widget_routing_id_(MSG_ROUTING_NONE), |
| 353 fullscreen_widget_had_focus_at_shutdown_(false), | 353 fullscreen_widget_had_focus_at_shutdown_(false), |
| 354 is_subframe_(false), | 354 is_subframe_(false), |
| 355 force_disable_overscroll_content_(false), | 355 force_disable_overscroll_content_(false), |
| 356 last_dialog_suppressed_(false), | 356 last_dialog_suppressed_(false), |
| 357 geolocation_service_context_(new GeolocationServiceContext()), | 357 geolocation_service_context_(new GeolocationServiceContext()), |
| 358 accessibility_mode_( | 358 accessibility_mode_( |
| 359 BrowserAccessibilityStateImpl::GetInstance()->accessibility_mode()), | 359 BrowserAccessibilityStateImpl::GetInstance()->accessibility_mode()), |
| 360 audio_stream_monitor_(this), | 360 audio_stream_monitor_(this), |
| 361 bluetooth_device_connected_(false), | 361 bluetooth_connected_device_count_(0), |
| 362 virtual_keyboard_requested_(false), | 362 virtual_keyboard_requested_(false), |
| 363 page_scale_factor_is_one_(true), | 363 page_scale_factor_is_one_(true), |
| 364 loading_weak_factory_(this), | 364 loading_weak_factory_(this), |
| 365 weak_factory_(this) { | 365 weak_factory_(this) { |
| 366 frame_tree_.SetFrameRemoveListener( | 366 frame_tree_.SetFrameRemoveListener( |
| 367 base::Bind(&WebContentsImpl::OnFrameRemoved, | 367 base::Bind(&WebContentsImpl::OnFrameRemoved, |
| 368 base::Unretained(this))); | 368 base::Unretained(this))); |
| 369 #if defined(OS_ANDROID) | 369 #if defined(OS_ANDROID) |
| 370 media_web_contents_observer_.reset(new MediaWebContentsObserverAndroid(this)); | 370 media_web_contents_observer_.reset(new MediaWebContentsObserverAndroid(this)); |
| 371 #else | 371 #else |
| (...skipping 746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1118 audio_muter_->StopMuting(); | 1118 audio_muter_->StopMuting(); |
| 1119 } | 1119 } |
| 1120 | 1120 |
| 1121 FOR_EACH_OBSERVER(WebContentsObserver, observers_, | 1121 FOR_EACH_OBSERVER(WebContentsObserver, observers_, |
| 1122 DidUpdateAudioMutingState(mute)); | 1122 DidUpdateAudioMutingState(mute)); |
| 1123 | 1123 |
| 1124 // Notification for UI updates in response to the changed muting state. | 1124 // Notification for UI updates in response to the changed muting state. |
| 1125 NotifyNavigationStateChanged(INVALIDATE_TYPE_TAB); | 1125 NotifyNavigationStateChanged(INVALIDATE_TYPE_TAB); |
| 1126 } | 1126 } |
| 1127 | 1127 |
| 1128 bool WebContentsImpl::IsBluetoothDeviceConnected() const { | 1128 void WebContentsImpl::IncrementBluetoothConnectedDeviceCount() { |
| 1129 return bluetooth_device_connected_; | 1129 // Notify for UI updates if the state changes. |
| 1130 bluetooth_connected_device_count_++; |
| 1131 if (bluetooth_connected_device_count_ == 1) { |
| 1132 NotifyNavigationStateChanged(INVALIDATE_TYPE_TAB); |
| 1133 } |
| 1130 } | 1134 } |
| 1131 | 1135 |
| 1132 void WebContentsImpl::SetBluetoothDeviceConnected(bool connected) { | 1136 void WebContentsImpl::DecrementBluetoothConnectedDeviceCount() { |
| 1133 bluetooth_device_connected_ = connected; | 1137 // Notify for UI updates if the state changes. |
| 1134 // Notification for UI updates in response to the connected device. | 1138 DCHECK(bluetooth_connected_device_count_ != 0); |
| 1135 NotifyNavigationStateChanged(INVALIDATE_TYPE_TAB); | 1139 bluetooth_connected_device_count_--; |
| 1140 if (bluetooth_connected_device_count_ == 0) { |
| 1141 NotifyNavigationStateChanged(INVALIDATE_TYPE_TAB); |
| 1142 } |
| 1143 } |
| 1144 |
| 1145 bool WebContentsImpl::IsConnectedToBluetoothDevice() const { |
| 1146 return bluetooth_connected_device_count_ > 0; |
| 1136 } | 1147 } |
| 1137 | 1148 |
| 1138 bool WebContentsImpl::IsCrashed() const { | 1149 bool WebContentsImpl::IsCrashed() const { |
| 1139 return (crashed_status_ == base::TERMINATION_STATUS_PROCESS_CRASHED || | 1150 return (crashed_status_ == base::TERMINATION_STATUS_PROCESS_CRASHED || |
| 1140 crashed_status_ == base::TERMINATION_STATUS_ABNORMAL_TERMINATION || | 1151 crashed_status_ == base::TERMINATION_STATUS_ABNORMAL_TERMINATION || |
| 1141 crashed_status_ == base::TERMINATION_STATUS_PROCESS_WAS_KILLED || | 1152 crashed_status_ == base::TERMINATION_STATUS_PROCESS_WAS_KILLED || |
| 1142 #if defined(OS_CHROMEOS) | 1153 #if defined(OS_CHROMEOS) |
| 1143 crashed_status_ == | 1154 crashed_status_ == |
| 1144 base::TERMINATION_STATUS_PROCESS_WAS_KILLED_BY_OOM || | 1155 base::TERMINATION_STATUS_PROCESS_WAS_KILLED_BY_OOM || |
| 1145 #endif | 1156 #endif |
| (...skipping 3700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4846 else | 4857 else |
| 4847 WasHidden(); | 4858 WasHidden(); |
| 4848 } | 4859 } |
| 4849 | 4860 |
| 4850 void WebContentsImpl::SetJavaScriptDialogManagerForTesting( | 4861 void WebContentsImpl::SetJavaScriptDialogManagerForTesting( |
| 4851 JavaScriptDialogManager* dialog_manager) { | 4862 JavaScriptDialogManager* dialog_manager) { |
| 4852 dialog_manager_ = dialog_manager; | 4863 dialog_manager_ = dialog_manager; |
| 4853 } | 4864 } |
| 4854 | 4865 |
| 4855 } // namespace content | 4866 } // namespace content |
| OLD | NEW |