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

Side by Side Diff: content/browser/devtools/protocol/page_handler.cc

Issue 2317563004: Change blink::WebScreenInfo to content::ScreenInfo (Closed)
Patch Set: Fix Windows compile Created 4 years, 3 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/devtools/protocol/page_handler.h" 5 #include "content/browser/devtools/protocol/page_handler.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/base64.h" 9 #include "base/base64.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 13 matching lines...) Expand all
24 #include "content/public/browser/browser_thread.h" 24 #include "content/public/browser/browser_thread.h"
25 #include "content/public/browser/javascript_dialog_manager.h" 25 #include "content/public/browser/javascript_dialog_manager.h"
26 #include "content/public/browser/navigation_controller.h" 26 #include "content/public/browser/navigation_controller.h"
27 #include "content/public/browser/navigation_entry.h" 27 #include "content/public/browser/navigation_entry.h"
28 #include "content/public/browser/navigation_handle.h" 28 #include "content/public/browser/navigation_handle.h"
29 #include "content/public/browser/notification_service.h" 29 #include "content/public/browser/notification_service.h"
30 #include "content/public/browser/notification_types.h" 30 #include "content/public/browser/notification_types.h"
31 #include "content/public/browser/storage_partition.h" 31 #include "content/public/browser/storage_partition.h"
32 #include "content/public/browser/web_contents_delegate.h" 32 #include "content/public/browser/web_contents_delegate.h"
33 #include "content/public/common/referrer.h" 33 #include "content/public/common/referrer.h"
34 #include "third_party/WebKit/public/platform/WebScreenInfo.h"
35 #include "third_party/skia/include/core/SkBitmap.h" 34 #include "third_party/skia/include/core/SkBitmap.h"
36 #include "ui/base/page_transition_types.h" 35 #include "ui/base/page_transition_types.h"
37 #include "ui/gfx/codec/jpeg_codec.h" 36 #include "ui/gfx/codec/jpeg_codec.h"
38 #include "ui/gfx/codec/png_codec.h" 37 #include "ui/gfx/codec/png_codec.h"
39 #include "ui/gfx/geometry/size_conversions.h" 38 #include "ui/gfx/geometry/size_conversions.h"
40 #include "ui/snapshot/snapshot.h" 39 #include "ui/snapshot/snapshot.h"
41 #include "url/gurl.h" 40 #include "url/gurl.h"
42 41
43 namespace content { 42 namespace content {
44 namespace devtools { 43 namespace devtools {
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 host_->GetView()); 463 host_->GetView());
465 // TODO(vkuzkokov): do not use previous frame metadata. 464 // TODO(vkuzkokov): do not use previous frame metadata.
466 cc::CompositorFrameMetadata& metadata = last_compositor_frame_metadata_; 465 cc::CompositorFrameMetadata& metadata = last_compositor_frame_metadata_;
467 466
468 gfx::SizeF viewport_size_dip = gfx::ScaleSize( 467 gfx::SizeF viewport_size_dip = gfx::ScaleSize(
469 metadata.scrollable_viewport_size, metadata.page_scale_factor); 468 metadata.scrollable_viewport_size, metadata.page_scale_factor);
470 gfx::SizeF screen_size_dip = 469 gfx::SizeF screen_size_dip =
471 gfx::ScaleSize(gfx::SizeF(view->GetPhysicalBackingSize()), 470 gfx::ScaleSize(gfx::SizeF(view->GetPhysicalBackingSize()),
472 1 / metadata.device_scale_factor); 471 1 / metadata.device_scale_factor);
473 472
474 blink::WebScreenInfo screen_info; 473 content::ScreenInfo screen_info;
475 GetWebContents()->GetView()->GetScreenInfo(&screen_info); 474 GetWebContents()->GetView()->GetScreenInfo(&screen_info);
476 double device_scale_factor = screen_info.deviceScaleFactor; 475 double device_scale_factor = screen_info.device_scale_factor;
477 double scale = 1; 476 double scale = 1;
478 477
479 if (screencast_max_width_ > 0) { 478 if (screencast_max_width_ > 0) {
480 double max_width_dip = screencast_max_width_ / device_scale_factor; 479 double max_width_dip = screencast_max_width_ / device_scale_factor;
481 scale = std::min(scale, max_width_dip / screen_size_dip.width()); 480 scale = std::min(scale, max_width_dip / screen_size_dip.width());
482 } 481 }
483 if (screencast_max_height_ > 0) { 482 if (screencast_max_height_ > 0) {
484 double max_height_dip = screencast_max_height_ / device_scale_factor; 483 double max_height_dip = screencast_max_height_ / device_scale_factor;
485 scale = std::min(scale, max_height_dip / screen_size_dip.height()); 484 scale = std::min(scale, max_height_dip / screen_size_dip.height());
486 } 485 }
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 580
582 void PageHandler::OnColorPicked(int r, int g, int b, int a) { 581 void PageHandler::OnColorPicked(int r, int g, int b, int a) {
583 scoped_refptr<dom::RGBA> color = 582 scoped_refptr<dom::RGBA> color =
584 dom::RGBA::Create()->set_r(r)->set_g(g)->set_b(b)->set_a(a); 583 dom::RGBA::Create()->set_r(r)->set_g(g)->set_b(b)->set_a(a);
585 client_->ColorPicked(ColorPickedParams::Create()->set_color(color)); 584 client_->ColorPicked(ColorPickedParams::Create()->set_color(color));
586 } 585 }
587 586
588 } // namespace page 587 } // namespace page
589 } // namespace devtools 588 } // namespace devtools
590 } // namespace content 589 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698