| 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/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 should_normally_be_visible_(true), | 309 should_normally_be_visible_(true), |
| 310 is_being_destroyed_(false), | 310 is_being_destroyed_(false), |
| 311 notify_disconnection_(false), | 311 notify_disconnection_(false), |
| 312 dialog_manager_(NULL), | 312 dialog_manager_(NULL), |
| 313 is_showing_before_unload_dialog_(false), | 313 is_showing_before_unload_dialog_(false), |
| 314 closed_by_user_gesture_(false), | 314 closed_by_user_gesture_(false), |
| 315 minimum_zoom_percent_(static_cast<int>(kMinimumZoomFactor * 100)), | 315 minimum_zoom_percent_(static_cast<int>(kMinimumZoomFactor * 100)), |
| 316 maximum_zoom_percent_(static_cast<int>(kMaximumZoomFactor * 100)), | 316 maximum_zoom_percent_(static_cast<int>(kMaximumZoomFactor * 100)), |
| 317 temporary_zoom_settings_(false), | 317 temporary_zoom_settings_(false), |
| 318 content_restrictions_(0), | 318 content_restrictions_(0), |
| 319 color_chooser_(NULL), | 319 color_chooser_identifier_(0), |
| 320 message_source_(NULL), | 320 message_source_(NULL), |
| 321 fullscreen_widget_routing_id_(MSG_ROUTING_NONE) { | 321 fullscreen_widget_routing_id_(MSG_ROUTING_NONE) { |
| 322 } | 322 } |
| 323 | 323 |
| 324 WebContentsImpl::~WebContentsImpl() { | 324 WebContentsImpl::~WebContentsImpl() { |
| 325 is_being_destroyed_ = true; | 325 is_being_destroyed_ = true; |
| 326 | 326 |
| 327 for (std::set<RenderWidgetHostImpl*>::iterator iter = | 327 for (std::set<RenderWidgetHostImpl*>::iterator iter = |
| 328 created_widgets_.begin(); iter != created_widgets_.end(); ++iter) { | 328 created_widgets_.begin(); iter != created_widgets_.end(); ++iter) { |
| 329 (*iter)->DetachDelegate(); | 329 (*iter)->DetachDelegate(); |
| (...skipping 1637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1967 | 1967 |
| 1968 bool WebContentsImpl::GotResponseToLockMouseRequest(bool allowed) { | 1968 bool WebContentsImpl::GotResponseToLockMouseRequest(bool allowed) { |
| 1969 return GetRenderViewHost() ? | 1969 return GetRenderViewHost() ? |
| 1970 GetRenderViewHostImpl()->GotResponseToLockMouseRequest(allowed) : false; | 1970 GetRenderViewHostImpl()->GotResponseToLockMouseRequest(allowed) : false; |
| 1971 } | 1971 } |
| 1972 | 1972 |
| 1973 bool WebContentsImpl::HasOpener() const { | 1973 bool WebContentsImpl::HasOpener() const { |
| 1974 return opener_ != NULL; | 1974 return opener_ != NULL; |
| 1975 } | 1975 } |
| 1976 | 1976 |
| 1977 void WebContentsImpl::DidChooseColorInColorChooser(int color_chooser_id, | 1977 void WebContentsImpl::DidChooseColorInColorChooser(SkColor color) { |
| 1978 SkColor color) { | |
| 1979 Send(new ViewMsg_DidChooseColorResponse( | 1978 Send(new ViewMsg_DidChooseColorResponse( |
| 1980 GetRoutingID(), color_chooser_id, color)); | 1979 GetRoutingID(), color_chooser_identifier_, color)); |
| 1981 } | 1980 } |
| 1982 | 1981 |
| 1983 void WebContentsImpl::DidEndColorChooser(int color_chooser_id) { | 1982 void WebContentsImpl::DidEndColorChooser() { |
| 1984 Send(new ViewMsg_DidEndColorChooser(GetRoutingID(), color_chooser_id)); | 1983 Send(new ViewMsg_DidEndColorChooser(GetRoutingID(), |
| 1985 if (delegate_) | 1984 color_chooser_identifier_)); |
| 1986 delegate_->DidEndColorChooser(); | 1985 color_chooser_.reset(); |
| 1987 color_chooser_ = NULL; | 1986 color_chooser_identifier_ = 0; |
| 1988 } | 1987 } |
| 1989 | 1988 |
| 1990 int WebContentsImpl::DownloadImage(const GURL& url, | 1989 int WebContentsImpl::DownloadImage(const GURL& url, |
| 1991 bool is_favicon, | 1990 bool is_favicon, |
| 1992 int image_size, | 1991 int image_size, |
| 1993 const ImageDownloadCallback& callback) { | 1992 const ImageDownloadCallback& callback) { |
| 1994 RenderViewHost* host = GetRenderViewHost(); | 1993 RenderViewHost* host = GetRenderViewHost(); |
| 1995 int id = StartDownload(host, url, is_favicon, image_size); | 1994 int id = StartDownload(host, url, is_favicon, image_size); |
| 1996 image_download_map_[id] = callback; | 1995 image_download_map_[id] = callback; |
| 1997 return id; | 1996 return id; |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2323 | 2322 |
| 2324 void WebContentsImpl::OnAppCacheAccessed(const GURL& manifest_url, | 2323 void WebContentsImpl::OnAppCacheAccessed(const GURL& manifest_url, |
| 2325 bool blocked_by_policy) { | 2324 bool blocked_by_policy) { |
| 2326 // Notify observers about navigation. | 2325 // Notify observers about navigation. |
| 2327 FOR_EACH_OBSERVER(WebContentsObserver, observers_, | 2326 FOR_EACH_OBSERVER(WebContentsObserver, observers_, |
| 2328 AppCacheAccessed(manifest_url, blocked_by_policy)); | 2327 AppCacheAccessed(manifest_url, blocked_by_policy)); |
| 2329 } | 2328 } |
| 2330 | 2329 |
| 2331 void WebContentsImpl::OnOpenColorChooser(int color_chooser_id, | 2330 void WebContentsImpl::OnOpenColorChooser(int color_chooser_id, |
| 2332 SkColor color) { | 2331 SkColor color) { |
| 2333 color_chooser_ = delegate_ ? | 2332 ColorChooser* new_color_chooser = delegate_->OpenColorChooser(this, color); |
| 2334 delegate_->OpenColorChooser(this, color_chooser_id, color) : NULL; | 2333 if (color_chooser_ == new_color_chooser) |
| 2334 return; |
| 2335 color_chooser_.reset(new_color_chooser); |
| 2336 color_chooser_identifier_ = color_chooser_id; |
| 2335 } | 2337 } |
| 2336 | 2338 |
| 2337 void WebContentsImpl::OnEndColorChooser(int color_chooser_id) { | 2339 void WebContentsImpl::OnEndColorChooser(int color_chooser_id) { |
| 2338 if (color_chooser_ && | 2340 if (color_chooser_ && |
| 2339 color_chooser_id == color_chooser_->identifier()) | 2341 color_chooser_id == color_chooser_identifier_) |
| 2340 color_chooser_->End(); | 2342 color_chooser_->End(); |
| 2341 } | 2343 } |
| 2342 | 2344 |
| 2343 void WebContentsImpl::OnSetSelectedColorInColorChooser(int color_chooser_id, | 2345 void WebContentsImpl::OnSetSelectedColorInColorChooser(int color_chooser_id, |
| 2344 SkColor color) { | 2346 SkColor color) { |
| 2345 if (color_chooser_ && | 2347 if (color_chooser_ && |
| 2346 color_chooser_id == color_chooser_->identifier()) | 2348 color_chooser_id == color_chooser_identifier_) |
| 2347 color_chooser_->SetSelectedColor(color); | 2349 color_chooser_->SetSelectedColor(color); |
| 2348 } | 2350 } |
| 2349 | 2351 |
| 2350 void WebContentsImpl::OnPepperPluginHung(int plugin_child_id, | 2352 void WebContentsImpl::OnPepperPluginHung(int plugin_child_id, |
| 2351 const base::FilePath& path, | 2353 const base::FilePath& path, |
| 2352 bool is_hung) { | 2354 bool is_hung) { |
| 2353 UMA_HISTOGRAM_COUNTS("Pepper.PluginHung", 1); | 2355 UMA_HISTOGRAM_COUNTS("Pepper.PluginHung", 1); |
| 2354 | 2356 |
| 2355 FOR_EACH_OBSERVER(WebContentsObserver, observers_, | 2357 FOR_EACH_OBSERVER(WebContentsObserver, observers_, |
| 2356 PluginHungStatusChanged(plugin_child_id, path, is_hung)); | 2358 PluginHungStatusChanged(plugin_child_id, path, is_hung)); |
| (...skipping 1167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3524 } | 3526 } |
| 3525 | 3527 |
| 3526 BrowserPluginGuestManager* | 3528 BrowserPluginGuestManager* |
| 3527 WebContentsImpl::GetBrowserPluginGuestManager() const { | 3529 WebContentsImpl::GetBrowserPluginGuestManager() const { |
| 3528 return static_cast<BrowserPluginGuestManager*>( | 3530 return static_cast<BrowserPluginGuestManager*>( |
| 3529 GetBrowserContext()->GetUserData( | 3531 GetBrowserContext()->GetUserData( |
| 3530 browser_plugin::kBrowserPluginGuestManagerKeyName)); | 3532 browser_plugin::kBrowserPluginGuestManagerKeyName)); |
| 3531 } | 3533 } |
| 3532 | 3534 |
| 3533 } // namespace content | 3535 } // namespace content |
| OLD | NEW |