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 <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 load_state_(net::LOAD_STATE_IDLE, string16()), | 343 load_state_(net::LOAD_STATE_IDLE, string16()), |
344 upload_size_(0), | 344 upload_size_(0), |
345 upload_position_(0), | 345 upload_position_(0), |
346 displayed_insecure_content_(false), | 346 displayed_insecure_content_(false), |
347 capturer_count_(0), | 347 capturer_count_(0), |
348 should_normally_be_visible_(true), | 348 should_normally_be_visible_(true), |
349 is_being_destroyed_(false), | 349 is_being_destroyed_(false), |
350 notify_disconnection_(false), | 350 notify_disconnection_(false), |
351 dialog_manager_(NULL), | 351 dialog_manager_(NULL), |
352 is_showing_before_unload_dialog_(false), | 352 is_showing_before_unload_dialog_(false), |
| 353 detached_as_part_of_unload_(false), |
353 closed_by_user_gesture_(false), | 354 closed_by_user_gesture_(false), |
354 minimum_zoom_percent_(static_cast<int>(kMinimumZoomFactor * 100)), | 355 minimum_zoom_percent_(static_cast<int>(kMinimumZoomFactor * 100)), |
355 maximum_zoom_percent_(static_cast<int>(kMaximumZoomFactor * 100)), | 356 maximum_zoom_percent_(static_cast<int>(kMaximumZoomFactor * 100)), |
356 temporary_zoom_settings_(false), | 357 temporary_zoom_settings_(false), |
357 content_restrictions_(0), | 358 content_restrictions_(0), |
358 color_chooser_identifier_(0), | 359 color_chooser_identifier_(0), |
359 message_source_(NULL), | 360 message_source_(NULL), |
360 fullscreen_widget_routing_id_(MSG_ROUTING_NONE) { | 361 fullscreen_widget_routing_id_(MSG_ROUTING_NONE) { |
361 for (size_t i = 0; i < g_created_callbacks.Get().size(); i++) | 362 for (size_t i = 0; i < g_created_callbacks.Get().size(); i++) |
362 g_created_callbacks.Get().at(i).Run(this); | 363 g_created_callbacks.Get().at(i).Run(this); |
(...skipping 1608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1971 void WebContentsImpl::OnCloseCanceled() { | 1972 void WebContentsImpl::OnCloseCanceled() { |
1972 close_start_time_ = base::TimeTicks(); | 1973 close_start_time_ = base::TimeTicks(); |
1973 before_unload_end_time_ = base::TimeTicks(); | 1974 before_unload_end_time_ = base::TimeTicks(); |
1974 unload_detached_start_time_ = base::TimeTicks(); | 1975 unload_detached_start_time_ = base::TimeTicks(); |
1975 } | 1976 } |
1976 | 1977 |
1977 void WebContentsImpl::OnUnloadStarted() { | 1978 void WebContentsImpl::OnUnloadStarted() { |
1978 before_unload_end_time_ = base::TimeTicks::Now(); | 1979 before_unload_end_time_ = base::TimeTicks::Now(); |
1979 } | 1980 } |
1980 | 1981 |
| 1982 void WebContentsImpl::OnUnloadAboutToDetach() { |
| 1983 detached_as_part_of_unload_ = true; |
| 1984 } |
| 1985 |
1981 void WebContentsImpl::OnUnloadDetachedStarted() { | 1986 void WebContentsImpl::OnUnloadDetachedStarted() { |
1982 if (unload_detached_start_time_.is_null()) | 1987 if (unload_detached_start_time_.is_null()) |
1983 unload_detached_start_time_ = base::TimeTicks::Now(); | 1988 unload_detached_start_time_ = base::TimeTicks::Now(); |
1984 } | 1989 } |
1985 | 1990 |
1986 void WebContentsImpl::DragSourceEndedAt(int client_x, int client_y, | 1991 void WebContentsImpl::DragSourceEndedAt(int client_x, int client_y, |
1987 int screen_x, int screen_y, WebKit::WebDragOperation operation) { | 1992 int screen_x, int screen_y, WebKit::WebDragOperation operation) { |
1988 if (browser_plugin_embedder_.get()) | 1993 if (browser_plugin_embedder_.get()) |
1989 browser_plugin_embedder_->DragSourceEndedAt(client_x, client_y, | 1994 browser_plugin_embedder_->DragSourceEndedAt(client_x, client_y, |
1990 screen_x, screen_y, operation); | 1995 screen_x, screen_y, operation); |
(...skipping 26 matching lines...) Expand all Loading... |
2017 } | 2022 } |
2018 | 2023 |
2019 void WebContentsImpl::SetClosedByUserGesture(bool value) { | 2024 void WebContentsImpl::SetClosedByUserGesture(bool value) { |
2020 closed_by_user_gesture_ = value; | 2025 closed_by_user_gesture_ = value; |
2021 } | 2026 } |
2022 | 2027 |
2023 bool WebContentsImpl::GetClosedByUserGesture() const { | 2028 bool WebContentsImpl::GetClosedByUserGesture() const { |
2024 return closed_by_user_gesture_; | 2029 return closed_by_user_gesture_; |
2025 } | 2030 } |
2026 | 2031 |
| 2032 bool WebContentsImpl::GetWebContentsDetachedToClose() const { |
| 2033 return detached_as_part_of_unload_; |
| 2034 } |
| 2035 |
2027 double WebContentsImpl::GetZoomLevel() const { | 2036 double WebContentsImpl::GetZoomLevel() const { |
2028 HostZoomMapImpl* zoom_map = static_cast<HostZoomMapImpl*>( | 2037 HostZoomMapImpl* zoom_map = static_cast<HostZoomMapImpl*>( |
2029 HostZoomMap::GetForBrowserContext(GetBrowserContext())); | 2038 HostZoomMap::GetForBrowserContext(GetBrowserContext())); |
2030 if (!zoom_map) | 2039 if (!zoom_map) |
2031 return 0; | 2040 return 0; |
2032 | 2041 |
2033 double zoom_level; | 2042 double zoom_level; |
2034 if (temporary_zoom_settings_) { | 2043 if (temporary_zoom_settings_) { |
2035 zoom_level = zoom_map->GetTemporaryZoomLevel( | 2044 zoom_level = zoom_map->GetTemporaryZoomLevel( |
2036 GetRenderProcessHost()->GetID(), GetRenderViewHost()->GetRoutingID()); | 2045 GetRenderProcessHost()->GetID(), GetRenderViewHost()->GetRoutingID()); |
(...skipping 1666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3703 } | 3712 } |
3704 | 3713 |
3705 BrowserPluginGuestManager* | 3714 BrowserPluginGuestManager* |
3706 WebContentsImpl::GetBrowserPluginGuestManager() const { | 3715 WebContentsImpl::GetBrowserPluginGuestManager() const { |
3707 return static_cast<BrowserPluginGuestManager*>( | 3716 return static_cast<BrowserPluginGuestManager*>( |
3708 GetBrowserContext()->GetUserData( | 3717 GetBrowserContext()->GetUserData( |
3709 browser_plugin::kBrowserPluginGuestManagerKeyName)); | 3718 browser_plugin::kBrowserPluginGuestManagerKeyName)); |
3710 } | 3719 } |
3711 | 3720 |
3712 } // namespace content | 3721 } // namespace content |
OLD | NEW |