Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(912)

Side by Side Diff: content/browser/web_contents/web_contents_impl.cc

Issue 13150004: Support color chooser inside extesions, apps, chrome frame, dev tool (Closed) Base URL: http://git.chromium.org/chromium/src.git@ngcolor
Patch Set: Removed chrome/browser/ui/color_chooser.cc Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 1595 matching lines...) Expand 10 before | Expand all | Expand 10 after
1913 1913
1914 bool WebContentsImpl::GotResponseToLockMouseRequest(bool allowed) { 1914 bool WebContentsImpl::GotResponseToLockMouseRequest(bool allowed) {
1915 return GetRenderViewHost() ? 1915 return GetRenderViewHost() ?
1916 GetRenderViewHostImpl()->GotResponseToLockMouseRequest(allowed) : false; 1916 GetRenderViewHostImpl()->GotResponseToLockMouseRequest(allowed) : false;
1917 } 1917 }
1918 1918
1919 bool WebContentsImpl::HasOpener() const { 1919 bool WebContentsImpl::HasOpener() const {
1920 return opener_ != NULL; 1920 return opener_ != NULL;
1921 } 1921 }
1922 1922
1923 void WebContentsImpl::DidChooseColorInColorChooser(int color_chooser_id, 1923 void WebContentsImpl::DidChooseColorInColorChooser(SkColor color) {
1924 SkColor color) {
1925 Send(new ViewMsg_DidChooseColorResponse( 1924 Send(new ViewMsg_DidChooseColorResponse(
1926 GetRoutingID(), color_chooser_id, color)); 1925 GetRoutingID(), color_chooser_identifier_, color));
1927 } 1926 }
1928 1927
1929 void WebContentsImpl::DidEndColorChooser(int color_chooser_id) { 1928 void WebContentsImpl::DidEndColorChooser() {
1930 Send(new ViewMsg_DidEndColorChooser(GetRoutingID(), color_chooser_id)); 1929 Send(new ViewMsg_DidEndColorChooser(GetRoutingID(),
1931 if (delegate_) 1930 color_chooser_identifier_));
1932 delegate_->DidEndColorChooser(); 1931 color_chooser_.reset();
1933 color_chooser_ = NULL; 1932 color_chooser_identifier_ = 0;
1934 } 1933 }
1935 1934
1936 int WebContentsImpl::DownloadImage(const GURL& url, 1935 int WebContentsImpl::DownloadImage(const GURL& url,
1937 bool is_favicon, 1936 bool is_favicon,
1938 int image_size, 1937 int image_size,
1939 const ImageDownloadCallback& callback) { 1938 const ImageDownloadCallback& callback) {
1940 RenderViewHost* host = GetRenderViewHost(); 1939 RenderViewHost* host = GetRenderViewHost();
1941 int id = StartDownload(host, url, is_favicon, image_size); 1940 int id = StartDownload(host, url, is_favicon, image_size);
1942 image_download_map_[id] = callback; 1941 image_download_map_[id] = callback;
1943 return id; 1942 return id;
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
2269 2268
2270 void WebContentsImpl::OnAppCacheAccessed(const GURL& manifest_url, 2269 void WebContentsImpl::OnAppCacheAccessed(const GURL& manifest_url,
2271 bool blocked_by_policy) { 2270 bool blocked_by_policy) {
2272 // Notify observers about navigation. 2271 // Notify observers about navigation.
2273 FOR_EACH_OBSERVER(WebContentsObserver, observers_, 2272 FOR_EACH_OBSERVER(WebContentsObserver, observers_,
2274 AppCacheAccessed(manifest_url, blocked_by_policy)); 2273 AppCacheAccessed(manifest_url, blocked_by_policy));
2275 } 2274 }
2276 2275
2277 void WebContentsImpl::OnOpenColorChooser(int color_chooser_id, 2276 void WebContentsImpl::OnOpenColorChooser(int color_chooser_id,
2278 SkColor color) { 2277 SkColor color) {
2279 color_chooser_ = delegate_ ? 2278 ColorChooser* new_color_chooser = delegate_->OpenColorChooser(this, color);
2280 delegate_->OpenColorChooser(this, color_chooser_id, color) : NULL; 2279 if (color_chooser_ == new_color_chooser)
2280 return;
2281 color_chooser_.reset(new_color_chooser);
2282 color_chooser_identifier_ = color_chooser_id;
2281 } 2283 }
2282 2284
2283 void WebContentsImpl::OnEndColorChooser(int color_chooser_id) { 2285 void WebContentsImpl::OnEndColorChooser(int color_chooser_id) {
2284 if (color_chooser_ && 2286 if (color_chooser_ &&
2285 color_chooser_id == color_chooser_->identifier()) 2287 color_chooser_id == color_chooser_identifier_)
2286 color_chooser_->End(); 2288 color_chooser_->End();
2287 } 2289 }
2288 2290
2289 void WebContentsImpl::OnSetSelectedColorInColorChooser(int color_chooser_id, 2291 void WebContentsImpl::OnSetSelectedColorInColorChooser(int color_chooser_id,
2290 SkColor color) { 2292 SkColor color) {
2291 if (color_chooser_ && 2293 if (color_chooser_ &&
2292 color_chooser_id == color_chooser_->identifier()) 2294 color_chooser_id == color_chooser_identifier_)
2293 color_chooser_->SetSelectedColor(color); 2295 color_chooser_->SetSelectedColor(color);
2294 } 2296 }
2295 2297
2296 void WebContentsImpl::OnPepperPluginHung(int plugin_child_id, 2298 void WebContentsImpl::OnPepperPluginHung(int plugin_child_id,
2297 const base::FilePath& path, 2299 const base::FilePath& path,
2298 bool is_hung) { 2300 bool is_hung) {
2299 UMA_HISTOGRAM_COUNTS("Pepper.PluginHung", 1); 2301 UMA_HISTOGRAM_COUNTS("Pepper.PluginHung", 1);
2300 2302
2301 FOR_EACH_OBSERVER(WebContentsObserver, observers_, 2303 FOR_EACH_OBSERVER(WebContentsObserver, observers_,
2302 PluginHungStatusChanged(plugin_child_id, path, is_hung)); 2304 PluginHungStatusChanged(plugin_child_id, path, is_hung));
(...skipping 1107 matching lines...) Expand 10 before | Expand all | Expand 10 after
3410 } 3412 }
3411 3413
3412 BrowserPluginGuestManager* 3414 BrowserPluginGuestManager*
3413 WebContentsImpl::GetBrowserPluginGuestManager() const { 3415 WebContentsImpl::GetBrowserPluginGuestManager() const {
3414 return static_cast<BrowserPluginGuestManager*>( 3416 return static_cast<BrowserPluginGuestManager*>(
3415 GetBrowserContext()->GetUserData( 3417 GetBrowserContext()->GetUserData(
3416 browser_plugin::kBrowserPluginGuestManagerKeyName)); 3418 browser_plugin::kBrowserPluginGuestManagerKeyName));
3417 } 3419 }
3418 3420
3419 } // namespace content 3421 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698