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

Side by Side Diff: chrome/browser/ui/views/create_application_shortcut_view.cc

Issue 293563002: GetScaleFactorForNativeView should return scale factor in float (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 | Annotate | Revision Log
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 "chrome/browser/ui/views/create_application_shortcut_view.h" 5 #include "chrome/browser/ui/views/create_application_shortcut_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 const std::vector<SkBitmap>& bitmaps, 488 const std::vector<SkBitmap>& bitmaps,
489 const std::vector<gfx::Size>& original_bitmap_sizes) { 489 const std::vector<gfx::Size>& original_bitmap_sizes) {
490 if (id != pending_download_id_) 490 if (id != pending_download_id_)
491 return; 491 return;
492 pending_download_id_ = -1; 492 pending_download_id_ = -1;
493 493
494 SkBitmap image; 494 SkBitmap image;
495 495
496 if (!bitmaps.empty()) { 496 if (!bitmaps.empty()) {
497 std::vector<ui::ScaleFactor> scale_factors; 497 std::vector<ui::ScaleFactor> scale_factors;
498 ui::ScaleFactor scale_factor = ui::GetScaleFactorForNativeView( 498 ui::ScaleFactor scale_factor = ui::GetSupportedScaleFactor(
499 web_contents_->GetRenderViewHost()->GetView()->GetNativeView()); 499 ui::GetScaleFactorForNativeView(
500 web_contents_->GetRenderViewHost()->GetView()->GetNativeView()));
500 scale_factors.push_back(scale_factor); 501 scale_factors.push_back(scale_factor);
501 std::vector<size_t> closest_indices; 502 std::vector<size_t> closest_indices;
502 SelectFaviconFrameIndices(original_bitmap_sizes, 503 SelectFaviconFrameIndices(original_bitmap_sizes,
503 scale_factors, 504 scale_factors,
504 requested_size, 505 requested_size,
505 &closest_indices, 506 &closest_indices,
506 NULL); 507 NULL);
507 size_t closest_index = closest_indices[0]; 508 size_t closest_index = closest_indices[0];
508 image = bitmaps[closest_index]; 509 image = bitmaps[closest_index];
509 } 510 }
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
554 } 555 }
555 556
556 // Called when the app's ShortcutInfo (with icon) is loaded. 557 // Called when the app's ShortcutInfo (with icon) is loaded.
557 void CreateChromeApplicationShortcutView::OnShortcutInfoLoaded( 558 void CreateChromeApplicationShortcutView::OnShortcutInfoLoaded(
558 const web_app::ShortcutInfo& shortcut_info) { 559 const web_app::ShortcutInfo& shortcut_info) {
559 shortcut_info_ = shortcut_info; 560 shortcut_info_ = shortcut_info;
560 561
561 CHECK(app_info_); 562 CHECK(app_info_);
562 static_cast<AppInfoView*>(app_info_)->UpdateIcon(shortcut_info_.favicon); 563 static_cast<AppInfoView*>(app_info_)->UpdateIcon(shortcut_info_.favicon);
563 } 564 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698