| 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 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 should_normally_be_visible_(true), | 296 should_normally_be_visible_(true), |
| 297 is_being_destroyed_(false), | 297 is_being_destroyed_(false), |
| 298 notify_disconnection_(false), | 298 notify_disconnection_(false), |
| 299 dialog_manager_(NULL), | 299 dialog_manager_(NULL), |
| 300 is_showing_before_unload_dialog_(false), | 300 is_showing_before_unload_dialog_(false), |
| 301 closed_by_user_gesture_(false), | 301 closed_by_user_gesture_(false), |
| 302 minimum_zoom_percent_(static_cast<int>(kMinimumZoomFactor * 100)), | 302 minimum_zoom_percent_(static_cast<int>(kMinimumZoomFactor * 100)), |
| 303 maximum_zoom_percent_(static_cast<int>(kMaximumZoomFactor * 100)), | 303 maximum_zoom_percent_(static_cast<int>(kMaximumZoomFactor * 100)), |
| 304 temporary_zoom_settings_(false), | 304 temporary_zoom_settings_(false), |
| 305 content_restrictions_(0), | 305 content_restrictions_(0), |
| 306 color_chooser_(NULL), | 306 color_chooser_identifier_(0), |
| 307 message_source_(NULL), | 307 message_source_(NULL), |
| 308 fullscreen_widget_routing_id_(MSG_ROUTING_NONE) { | 308 fullscreen_widget_routing_id_(MSG_ROUTING_NONE) { |
| 309 } | 309 } |
| 310 | 310 |
| 311 WebContentsImpl::~WebContentsImpl() { | 311 WebContentsImpl::~WebContentsImpl() { |
| 312 is_being_destroyed_ = true; | 312 is_being_destroyed_ = true; |
| 313 | 313 |
| 314 for (std::set<RenderWidgetHostImpl*>::iterator iter = | 314 for (std::set<RenderWidgetHostImpl*>::iterator iter = |
| 315 created_widgets_.begin(); iter != created_widgets_.end(); ++iter) { | 315 created_widgets_.begin(); iter != created_widgets_.end(); ++iter) { |
| 316 (*iter)->DetachDelegate(); | 316 (*iter)->DetachDelegate(); |
| (...skipping 1622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1939 | 1939 |
| 1940 bool WebContentsImpl::GotResponseToLockMouseRequest(bool allowed) { | 1940 bool WebContentsImpl::GotResponseToLockMouseRequest(bool allowed) { |
| 1941 return GetRenderViewHost() ? | 1941 return GetRenderViewHost() ? |
| 1942 GetRenderViewHostImpl()->GotResponseToLockMouseRequest(allowed) : false; | 1942 GetRenderViewHostImpl()->GotResponseToLockMouseRequest(allowed) : false; |
| 1943 } | 1943 } |
| 1944 | 1944 |
| 1945 bool WebContentsImpl::HasOpener() const { | 1945 bool WebContentsImpl::HasOpener() const { |
| 1946 return opener_ != NULL; | 1946 return opener_ != NULL; |
| 1947 } | 1947 } |
| 1948 | 1948 |
| 1949 void WebContentsImpl::DidChooseColorInColorChooser(int color_chooser_id, | 1949 void WebContentsImpl::DidChooseColorInColorChooser(SkColor color) { |
| 1950 SkColor color) { | |
| 1951 Send(new ViewMsg_DidChooseColorResponse( | 1950 Send(new ViewMsg_DidChooseColorResponse( |
| 1952 GetRoutingID(), color_chooser_id, color)); | 1951 GetRoutingID(), color_chooser_identifier_, color)); |
| 1953 } | 1952 } |
| 1954 | 1953 |
| 1955 void WebContentsImpl::DidEndColorChooser(int color_chooser_id) { | 1954 void WebContentsImpl::DidEndColorChooser() { |
| 1956 Send(new ViewMsg_DidEndColorChooser(GetRoutingID(), color_chooser_id)); | 1955 Send(new ViewMsg_DidEndColorChooser(GetRoutingID(), |
| 1957 if (delegate_) | 1956 color_chooser_identifier_)); |
| 1958 delegate_->DidEndColorChooser(); | 1957 color_chooser_.reset(); |
| 1959 color_chooser_ = NULL; | 1958 color_chooser_identifier_ = 0; |
| 1960 } | 1959 } |
| 1961 | 1960 |
| 1962 int WebContentsImpl::DownloadImage(const GURL& url, | 1961 int WebContentsImpl::DownloadImage(const GURL& url, |
| 1963 bool is_favicon, | 1962 bool is_favicon, |
| 1964 int image_size, | 1963 int image_size, |
| 1965 const ImageDownloadCallback& callback) { | 1964 const ImageDownloadCallback& callback) { |
| 1966 RenderViewHost* host = GetRenderViewHost(); | 1965 RenderViewHost* host = GetRenderViewHost(); |
| 1967 int id = StartDownload(host, url, is_favicon, image_size); | 1966 int id = StartDownload(host, url, is_favicon, image_size); |
| 1968 image_download_map_[id] = callback; | 1967 image_download_map_[id] = callback; |
| 1969 return id; | 1968 return id; |
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2298 | 2297 |
| 2299 void WebContentsImpl::OnAppCacheAccessed(const GURL& manifest_url, | 2298 void WebContentsImpl::OnAppCacheAccessed(const GURL& manifest_url, |
| 2300 bool blocked_by_policy) { | 2299 bool blocked_by_policy) { |
| 2301 // Notify observers about navigation. | 2300 // Notify observers about navigation. |
| 2302 FOR_EACH_OBSERVER(WebContentsObserver, observers_, | 2301 FOR_EACH_OBSERVER(WebContentsObserver, observers_, |
| 2303 AppCacheAccessed(manifest_url, blocked_by_policy)); | 2302 AppCacheAccessed(manifest_url, blocked_by_policy)); |
| 2304 } | 2303 } |
| 2305 | 2304 |
| 2306 void WebContentsImpl::OnOpenColorChooser(int color_chooser_id, | 2305 void WebContentsImpl::OnOpenColorChooser(int color_chooser_id, |
| 2307 SkColor color) { | 2306 SkColor color) { |
| 2308 color_chooser_ = delegate_ ? | 2307 ColorChooser* new_color_chooser = delegate_->OpenColorChooser(this, color); |
| 2309 delegate_->OpenColorChooser(this, color_chooser_id, color) : NULL; | 2308 if (!new_color_chooser) |
| 2309 return; |
| 2310 color_chooser_.reset(new_color_chooser); |
| 2311 color_chooser_identifier_ = color_chooser_id; |
| 2310 } | 2312 } |
| 2311 | 2313 |
| 2312 void WebContentsImpl::OnEndColorChooser(int color_chooser_id) { | 2314 void WebContentsImpl::OnEndColorChooser(int color_chooser_id) { |
| 2313 if (color_chooser_ && | 2315 if (color_chooser_ && |
| 2314 color_chooser_id == color_chooser_->identifier()) | 2316 color_chooser_id == color_chooser_identifier_) |
| 2315 color_chooser_->End(); | 2317 color_chooser_->End(); |
| 2316 } | 2318 } |
| 2317 | 2319 |
| 2318 void WebContentsImpl::OnSetSelectedColorInColorChooser(int color_chooser_id, | 2320 void WebContentsImpl::OnSetSelectedColorInColorChooser(int color_chooser_id, |
| 2319 SkColor color) { | 2321 SkColor color) { |
| 2320 if (color_chooser_ && | 2322 if (color_chooser_ && |
| 2321 color_chooser_id == color_chooser_->identifier()) | 2323 color_chooser_id == color_chooser_identifier_) |
| 2322 color_chooser_->SetSelectedColor(color); | 2324 color_chooser_->SetSelectedColor(color); |
| 2323 } | 2325 } |
| 2324 | 2326 |
| 2325 void WebContentsImpl::OnPepperPluginHung(int plugin_child_id, | 2327 void WebContentsImpl::OnPepperPluginHung(int plugin_child_id, |
| 2326 const base::FilePath& path, | 2328 const base::FilePath& path, |
| 2327 bool is_hung) { | 2329 bool is_hung) { |
| 2328 UMA_HISTOGRAM_COUNTS("Pepper.PluginHung", 1); | 2330 UMA_HISTOGRAM_COUNTS("Pepper.PluginHung", 1); |
| 2329 | 2331 |
| 2330 FOR_EACH_OBSERVER(WebContentsObserver, observers_, | 2332 FOR_EACH_OBSERVER(WebContentsObserver, observers_, |
| 2331 PluginHungStatusChanged(plugin_child_id, path, is_hung)); | 2333 PluginHungStatusChanged(plugin_child_id, path, is_hung)); |
| (...skipping 1105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3437 } | 3439 } |
| 3438 | 3440 |
| 3439 BrowserPluginGuestManager* | 3441 BrowserPluginGuestManager* |
| 3440 WebContentsImpl::GetBrowserPluginGuestManager() const { | 3442 WebContentsImpl::GetBrowserPluginGuestManager() const { |
| 3441 return static_cast<BrowserPluginGuestManager*>( | 3443 return static_cast<BrowserPluginGuestManager*>( |
| 3442 GetBrowserContext()->GetUserData( | 3444 GetBrowserContext()->GetUserData( |
| 3443 browser_plugin::kBrowserPluginGuestManagerKeyName)); | 3445 browser_plugin::kBrowserPluginGuestManagerKeyName)); |
| 3444 } | 3446 } |
| 3445 | 3447 |
| 3446 } // namespace content | 3448 } // namespace content |
| OLD | NEW |