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

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: Fixed android build Created 7 years, 7 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 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 1635 matching lines...) Expand 10 before | Expand all | Expand 10 after
1965 1965
1966 bool WebContentsImpl::GotResponseToLockMouseRequest(bool allowed) { 1966 bool WebContentsImpl::GotResponseToLockMouseRequest(bool allowed) {
1967 return GetRenderViewHost() ? 1967 return GetRenderViewHost() ?
1968 GetRenderViewHostImpl()->GotResponseToLockMouseRequest(allowed) : false; 1968 GetRenderViewHostImpl()->GotResponseToLockMouseRequest(allowed) : false;
1969 } 1969 }
1970 1970
1971 bool WebContentsImpl::HasOpener() const { 1971 bool WebContentsImpl::HasOpener() const {
1972 return opener_ != NULL; 1972 return opener_ != NULL;
1973 } 1973 }
1974 1974
1975 void WebContentsImpl::DidChooseColorInColorChooser(int color_chooser_id, 1975 void WebContentsImpl::DidChooseColorInColorChooser(SkColor color) {
1976 SkColor color) {
1977 Send(new ViewMsg_DidChooseColorResponse( 1976 Send(new ViewMsg_DidChooseColorResponse(
1978 GetRoutingID(), color_chooser_id, color)); 1977 GetRoutingID(), color_chooser_identifier_, color));
1979 } 1978 }
1980 1979
1981 void WebContentsImpl::DidEndColorChooser(int color_chooser_id) { 1980 void WebContentsImpl::DidEndColorChooser() {
1982 Send(new ViewMsg_DidEndColorChooser(GetRoutingID(), color_chooser_id)); 1981 Send(new ViewMsg_DidEndColorChooser(GetRoutingID(),
1983 if (delegate_) 1982 color_chooser_identifier_));
1984 delegate_->DidEndColorChooser(); 1983 color_chooser_.reset();
1985 color_chooser_ = NULL; 1984 color_chooser_identifier_ = 0;
1986 } 1985 }
1987 1986
1988 int WebContentsImpl::DownloadImage(const GURL& url, 1987 int WebContentsImpl::DownloadImage(const GURL& url,
1989 bool is_favicon, 1988 bool is_favicon,
1990 int image_size, 1989 int image_size,
1991 const ImageDownloadCallback& callback) { 1990 const ImageDownloadCallback& callback) {
1992 RenderViewHost* host = GetRenderViewHost(); 1991 RenderViewHost* host = GetRenderViewHost();
1993 int id = StartDownload(host, url, is_favicon, image_size); 1992 int id = StartDownload(host, url, is_favicon, image_size);
1994 image_download_map_[id] = callback; 1993 image_download_map_[id] = callback;
1995 return id; 1994 return id;
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
2321 2320
2322 void WebContentsImpl::OnAppCacheAccessed(const GURL& manifest_url, 2321 void WebContentsImpl::OnAppCacheAccessed(const GURL& manifest_url,
2323 bool blocked_by_policy) { 2322 bool blocked_by_policy) {
2324 // Notify observers about navigation. 2323 // Notify observers about navigation.
2325 FOR_EACH_OBSERVER(WebContentsObserver, observers_, 2324 FOR_EACH_OBSERVER(WebContentsObserver, observers_,
2326 AppCacheAccessed(manifest_url, blocked_by_policy)); 2325 AppCacheAccessed(manifest_url, blocked_by_policy));
2327 } 2326 }
2328 2327
2329 void WebContentsImpl::OnOpenColorChooser(int color_chooser_id, 2328 void WebContentsImpl::OnOpenColorChooser(int color_chooser_id,
2330 SkColor color) { 2329 SkColor color) {
2331 color_chooser_ = delegate_ ? 2330 ColorChooser* new_color_chooser = delegate_->OpenColorChooser(this, color);
2332 delegate_->OpenColorChooser(this, color_chooser_id, color) : NULL; 2331 if (color_chooser_ == new_color_chooser)
2332 return;
2333 color_chooser_.reset(new_color_chooser);
2334 color_chooser_identifier_ = color_chooser_id;
2333 } 2335 }
2334 2336
2335 void WebContentsImpl::OnEndColorChooser(int color_chooser_id) { 2337 void WebContentsImpl::OnEndColorChooser(int color_chooser_id) {
2336 if (color_chooser_ && 2338 if (color_chooser_ &&
2337 color_chooser_id == color_chooser_->identifier()) 2339 color_chooser_id == color_chooser_identifier_)
2338 color_chooser_->End(); 2340 color_chooser_->End();
2339 } 2341 }
2340 2342
2341 void WebContentsImpl::OnSetSelectedColorInColorChooser(int color_chooser_id, 2343 void WebContentsImpl::OnSetSelectedColorInColorChooser(int color_chooser_id,
2342 SkColor color) { 2344 SkColor color) {
2343 if (color_chooser_ && 2345 if (color_chooser_ &&
2344 color_chooser_id == color_chooser_->identifier()) 2346 color_chooser_id == color_chooser_identifier_)
2345 color_chooser_->SetSelectedColor(color); 2347 color_chooser_->SetSelectedColor(color);
2346 } 2348 }
2347 2349
2348 void WebContentsImpl::OnPepperPluginHung(int plugin_child_id, 2350 void WebContentsImpl::OnPepperPluginHung(int plugin_child_id,
2349 const base::FilePath& path, 2351 const base::FilePath& path,
2350 bool is_hung) { 2352 bool is_hung) {
2351 UMA_HISTOGRAM_COUNTS("Pepper.PluginHung", 1); 2353 UMA_HISTOGRAM_COUNTS("Pepper.PluginHung", 1);
2352 2354
2353 FOR_EACH_OBSERVER(WebContentsObserver, observers_, 2355 FOR_EACH_OBSERVER(WebContentsObserver, observers_,
2354 PluginHungStatusChanged(plugin_child_id, path, is_hung)); 2356 PluginHungStatusChanged(plugin_child_id, path, is_hung));
(...skipping 1168 matching lines...) Expand 10 before | Expand all | Expand 10 after
3523 } 3525 }
3524 3526
3525 BrowserPluginGuestManager* 3527 BrowserPluginGuestManager*
3526 WebContentsImpl::GetBrowserPluginGuestManager() const { 3528 WebContentsImpl::GetBrowserPluginGuestManager() const {
3527 return static_cast<BrowserPluginGuestManager*>( 3529 return static_cast<BrowserPluginGuestManager*>(
3528 GetBrowserContext()->GetUserData( 3530 GetBrowserContext()->GetUserData(
3529 browser_plugin::kBrowserPluginGuestManagerKeyName)); 3531 browser_plugin::kBrowserPluginGuestManagerKeyName));
3530 } 3532 }
3531 3533
3532 } // namespace content 3534 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/web_contents/web_contents_impl.h ('k') | content/public/browser/color_chooser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698