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 "chrome/browser/ui/views/toolbar_view.h" | 5 #include "chrome/browser/ui/views/toolbar_view.h" |
6 | 6 |
7 #include "base/i18n/number_formatting.h" | 7 #include "base/i18n/number_formatting.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "chrome/app/chrome_command_ids.h" | 9 #include "chrome/app/chrome_command_ids.h" |
10 #include "chrome/browser/command_updater.h" | 10 #include "chrome/browser/command_updater.h" |
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 | 342 |
343 int error_badge_id = GlobalErrorServiceFactory::GetForProfile( | 343 int error_badge_id = GlobalErrorServiceFactory::GetForProfile( |
344 browser_->profile())->GetFirstBadgeResourceID(); | 344 browser_->profile())->GetFirstBadgeResourceID(); |
345 | 345 |
346 bool add_badge = ShouldShowUpgradeRecommended() || | 346 bool add_badge = ShouldShowUpgradeRecommended() || |
347 ShouldShowIncompatibilityWarning() || error_badge_id; | 347 ShouldShowIncompatibilityWarning() || error_badge_id; |
348 if (!add_badge) | 348 if (!add_badge) |
349 return icon; | 349 return icon; |
350 | 350 |
351 // Draw the chrome app menu icon onto the canvas. | 351 // Draw the chrome app menu icon onto the canvas. |
352 scoped_ptr<gfx::Canvas> canvas(new gfx::Canvas(icon, false)); | 352 gfx::ImageSkiaRep image_rep = gfx::ImageSkiaRep(icon, ui::SCALE_FACTOR_100P); |
| 353 scoped_ptr<gfx::Canvas> canvas(new gfx::Canvas(image_rep, false)); |
353 | 354 |
354 gfx::ImageSkia badge; | 355 gfx::ImageSkia badge; |
355 // Only one badge can be active at any given time. The Upgrade notification | 356 // Only one badge can be active at any given time. The Upgrade notification |
356 // is deemed most important, then the DLL conflict badge. | 357 // is deemed most important, then the DLL conflict badge. |
357 if (ShouldShowUpgradeRecommended()) { | 358 if (ShouldShowUpgradeRecommended()) { |
358 badge = *tp->GetImageSkiaNamed( | 359 badge = *tp->GetImageSkiaNamed( |
359 UpgradeDetector::GetInstance()->GetIconResourceID( | 360 UpgradeDetector::GetInstance()->GetIconResourceID( |
360 UpgradeDetector::UPGRADE_ICON_TYPE_BADGE)); | 361 UpgradeDetector::UPGRADE_ICON_TYPE_BADGE)); |
361 } else if (ShouldShowIncompatibilityWarning()) { | 362 } else if (ShouldShowIncompatibilityWarning()) { |
362 #if defined(OS_WIN) | 363 #if defined(OS_WIN) |
(...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1000 // LocationBarContainer is not a child of the ToolbarView. | 1001 // LocationBarContainer is not a child of the ToolbarView. |
1001 gfx::Point origin(bounds.origin()); | 1002 gfx::Point origin(bounds.origin()); |
1002 views::View::ConvertPointToView(this, location_bar_container_->parent(), | 1003 views::View::ConvertPointToView(this, location_bar_container_->parent(), |
1003 &origin); | 1004 &origin); |
1004 gfx::Rect target_bounds(origin, bounds.size()); | 1005 gfx::Rect target_bounds(origin, bounds.size()); |
1005 if (location_bar_container_->GetTargetBounds() != target_bounds) { | 1006 if (location_bar_container_->GetTargetBounds() != target_bounds) { |
1006 location_bar_container_->SetInToolbar(true); | 1007 location_bar_container_->SetInToolbar(true); |
1007 location_bar_container_->SetBoundsRect(target_bounds); | 1008 location_bar_container_->SetBoundsRect(target_bounds); |
1008 } | 1009 } |
1009 } | 1010 } |
OLD | NEW |