| 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 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 should_normally_be_visible_(true), | 297 should_normally_be_visible_(true), |
| 298 is_being_destroyed_(false), | 298 is_being_destroyed_(false), |
| 299 notify_disconnection_(false), | 299 notify_disconnection_(false), |
| 300 dialog_manager_(NULL), | 300 dialog_manager_(NULL), |
| 301 is_showing_before_unload_dialog_(false), | 301 is_showing_before_unload_dialog_(false), |
| 302 closed_by_user_gesture_(false), | 302 closed_by_user_gesture_(false), |
| 303 minimum_zoom_percent_(static_cast<int>(kMinimumZoomFactor * 100)), | 303 minimum_zoom_percent_(static_cast<int>(kMinimumZoomFactor * 100)), |
| 304 maximum_zoom_percent_(static_cast<int>(kMaximumZoomFactor * 100)), | 304 maximum_zoom_percent_(static_cast<int>(kMaximumZoomFactor * 100)), |
| 305 temporary_zoom_settings_(false), | 305 temporary_zoom_settings_(false), |
| 306 content_restrictions_(0), | 306 content_restrictions_(0), |
| 307 color_chooser_(NULL), | 307 color_chooser_identifier_(0), |
| 308 message_source_(NULL), | 308 message_source_(NULL), |
| 309 fullscreen_widget_routing_id_(MSG_ROUTING_NONE) { | 309 fullscreen_widget_routing_id_(MSG_ROUTING_NONE) { |
| 310 } | 310 } |
| 311 | 311 |
| 312 WebContentsImpl::~WebContentsImpl() { | 312 WebContentsImpl::~WebContentsImpl() { |
| 313 is_being_destroyed_ = true; | 313 is_being_destroyed_ = true; |
| 314 | 314 |
| 315 for (std::set<RenderWidgetHostImpl*>::iterator iter = | 315 for (std::set<RenderWidgetHostImpl*>::iterator iter = |
| 316 created_widgets_.begin(); iter != created_widgets_.end(); ++iter) { | 316 created_widgets_.begin(); iter != created_widgets_.end(); ++iter) { |
| 317 (*iter)->DetachDelegate(); | 317 (*iter)->DetachDelegate(); |
| (...skipping 1591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1909 | 1909 |
| 1910 bool WebContentsImpl::GotResponseToLockMouseRequest(bool allowed) { | 1910 bool WebContentsImpl::GotResponseToLockMouseRequest(bool allowed) { |
| 1911 return GetRenderViewHost() ? | 1911 return GetRenderViewHost() ? |
| 1912 GetRenderViewHostImpl()->GotResponseToLockMouseRequest(allowed) : false; | 1912 GetRenderViewHostImpl()->GotResponseToLockMouseRequest(allowed) : false; |
| 1913 } | 1913 } |
| 1914 | 1914 |
| 1915 bool WebContentsImpl::HasOpener() const { | 1915 bool WebContentsImpl::HasOpener() const { |
| 1916 return opener_ != NULL; | 1916 return opener_ != NULL; |
| 1917 } | 1917 } |
| 1918 | 1918 |
| 1919 void WebContentsImpl::DidChooseColorInColorChooser(int color_chooser_id, | 1919 void WebContentsImpl::DidChooseColorInColorChooser(SkColor color) { |
| 1920 SkColor color) { | |
| 1921 Send(new ViewMsg_DidChooseColorResponse( | 1920 Send(new ViewMsg_DidChooseColorResponse( |
| 1922 GetRoutingID(), color_chooser_id, color)); | 1921 GetRoutingID(), color_chooser_identifier_, color)); |
| 1923 } | 1922 } |
| 1924 | 1923 |
| 1925 void WebContentsImpl::DidEndColorChooser(int color_chooser_id) { | 1924 void WebContentsImpl::DidEndColorChooser() { |
| 1926 Send(new ViewMsg_DidEndColorChooser(GetRoutingID(), color_chooser_id)); | 1925 Send(new ViewMsg_DidEndColorChooser(GetRoutingID(), |
| 1927 if (delegate_) | 1926 color_chooser_identifier_)); |
| 1928 delegate_->DidEndColorChooser(); | 1927 color_chooser_.reset(); |
| 1929 color_chooser_ = NULL; | 1928 color_chooser_identifier_ = 0; |
| 1930 } | 1929 } |
| 1931 | 1930 |
| 1932 int WebContentsImpl::DownloadImage(const GURL& url, | 1931 int WebContentsImpl::DownloadImage(const GURL& url, |
| 1933 bool is_favicon, | 1932 bool is_favicon, |
| 1934 int image_size, | 1933 int image_size, |
| 1935 const ImageDownloadCallback& callback) { | 1934 const ImageDownloadCallback& callback) { |
| 1936 RenderViewHost* host = GetRenderViewHost(); | 1935 RenderViewHost* host = GetRenderViewHost(); |
| 1937 int id = StartDownload(host, url, is_favicon, image_size); | 1936 int id = StartDownload(host, url, is_favicon, image_size); |
| 1938 image_download_map_[id] = callback; | 1937 image_download_map_[id] = callback; |
| 1939 return id; | 1938 return id; |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2265 | 2264 |
| 2266 void WebContentsImpl::OnAppCacheAccessed(const GURL& manifest_url, | 2265 void WebContentsImpl::OnAppCacheAccessed(const GURL& manifest_url, |
| 2267 bool blocked_by_policy) { | 2266 bool blocked_by_policy) { |
| 2268 // Notify observers about navigation. | 2267 // Notify observers about navigation. |
| 2269 FOR_EACH_OBSERVER(WebContentsObserver, observers_, | 2268 FOR_EACH_OBSERVER(WebContentsObserver, observers_, |
| 2270 AppCacheAccessed(manifest_url, blocked_by_policy)); | 2269 AppCacheAccessed(manifest_url, blocked_by_policy)); |
| 2271 } | 2270 } |
| 2272 | 2271 |
| 2273 void WebContentsImpl::OnOpenColorChooser(int color_chooser_id, | 2272 void WebContentsImpl::OnOpenColorChooser(int color_chooser_id, |
| 2274 SkColor color) { | 2273 SkColor color) { |
| 2275 color_chooser_ = delegate_ ? | 2274 ColorChooser* new_color_chooser = delegate_->OpenColorChooser(this, color); |
| 2276 delegate_->OpenColorChooser(this, color_chooser_id, color) : NULL; | 2275 if (color_chooser_ == new_color_chooser) |
| 2276 return; |
| 2277 color_chooser_.reset(new_color_chooser); |
| 2278 color_chooser_identifier_ = color_chooser_id; |
| 2277 } | 2279 } |
| 2278 | 2280 |
| 2279 void WebContentsImpl::OnEndColorChooser(int color_chooser_id) { | 2281 void WebContentsImpl::OnEndColorChooser(int color_chooser_id) { |
| 2280 if (color_chooser_ && | 2282 if (color_chooser_ && |
| 2281 color_chooser_id == color_chooser_->identifier()) | 2283 color_chooser_id == color_chooser_identifier_) |
| 2282 color_chooser_->End(); | 2284 color_chooser_->End(); |
| 2283 } | 2285 } |
| 2284 | 2286 |
| 2285 void WebContentsImpl::OnSetSelectedColorInColorChooser(int color_chooser_id, | 2287 void WebContentsImpl::OnSetSelectedColorInColorChooser(int color_chooser_id, |
| 2286 SkColor color) { | 2288 SkColor color) { |
| 2287 if (color_chooser_ && | 2289 if (color_chooser_ && |
| 2288 color_chooser_id == color_chooser_->identifier()) | 2290 color_chooser_id == color_chooser_identifier_) |
| 2289 color_chooser_->SetSelectedColor(color); | 2291 color_chooser_->SetSelectedColor(color); |
| 2290 } | 2292 } |
| 2291 | 2293 |
| 2292 void WebContentsImpl::OnPepperPluginHung(int plugin_child_id, | 2294 void WebContentsImpl::OnPepperPluginHung(int plugin_child_id, |
| 2293 const base::FilePath& path, | 2295 const base::FilePath& path, |
| 2294 bool is_hung) { | 2296 bool is_hung) { |
| 2295 UMA_HISTOGRAM_COUNTS("Pepper.PluginHung", 1); | 2297 UMA_HISTOGRAM_COUNTS("Pepper.PluginHung", 1); |
| 2296 | 2298 |
| 2297 FOR_EACH_OBSERVER(WebContentsObserver, observers_, | 2299 FOR_EACH_OBSERVER(WebContentsObserver, observers_, |
| 2298 PluginHungStatusChanged(plugin_child_id, path, is_hung)); | 2300 PluginHungStatusChanged(plugin_child_id, path, is_hung)); |
| (...skipping 1107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3406 } | 3408 } |
| 3407 | 3409 |
| 3408 BrowserPluginGuestManager* | 3410 BrowserPluginGuestManager* |
| 3409 WebContentsImpl::GetBrowserPluginGuestManager() const { | 3411 WebContentsImpl::GetBrowserPluginGuestManager() const { |
| 3410 return static_cast<BrowserPluginGuestManager*>( | 3412 return static_cast<BrowserPluginGuestManager*>( |
| 3411 GetBrowserContext()->GetUserData( | 3413 GetBrowserContext()->GetUserData( |
| 3412 browser_plugin::kBrowserPluginGuestManagerKeyName)); | 3414 browser_plugin::kBrowserPluginGuestManagerKeyName)); |
| 3413 } | 3415 } |
| 3414 | 3416 |
| 3415 } // namespace content | 3417 } // namespace content |
| OLD | NEW |