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

Side by Side Diff: chrome/browser/views/toolbar_view.cc

Issue 2862025: Canvas refactoring part 2.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 6 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
« no previous file with comments | « chrome/browser/views/theme_helpers.cc ('k') | chrome/renderer/webplugin_delegate_proxy.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/views/toolbar_view.h" 5 #include "chrome/browser/views/toolbar_view.h"
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "app/resource_bundle.h" 8 #include "app/resource_bundle.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "chrome/app/chrome_dll_resource.h" 10 #include "chrome/app/chrome_dll_resource.h"
11 #include "chrome/browser/browser.h" 11 #include "chrome/browser/browser.h"
12 #include "chrome/browser/browser_theme_provider.h" 12 #include "chrome/browser/browser_theme_provider.h"
13 #include "chrome/browser/browser_window.h" 13 #include "chrome/browser/browser_window.h"
14 #include "chrome/browser/pref_service.h" 14 #include "chrome/browser/pref_service.h"
15 #include "chrome/browser/profile.h" 15 #include "chrome/browser/profile.h"
16 #include "chrome/browser/upgrade_detector.h" 16 #include "chrome/browser/upgrade_detector.h"
17 #include "chrome/browser/view_ids.h" 17 #include "chrome/browser/view_ids.h"
18 #include "chrome/browser/views/bookmark_menu_button.h" 18 #include "chrome/browser/views/bookmark_menu_button.h"
19 #include "chrome/browser/views/browser_actions_container.h" 19 #include "chrome/browser/views/browser_actions_container.h"
20 #include "chrome/browser/views/event_utils.h" 20 #include "chrome/browser/views/event_utils.h"
21 #include "chrome/browser/views/frame/browser_view.h" 21 #include "chrome/browser/views/frame/browser_view.h"
22 #include "chrome/browser/wrench_menu_model.h" 22 #include "chrome/browser/wrench_menu_model.h"
23 #include "chrome/common/chrome_switches.h" 23 #include "chrome/common/chrome_switches.h"
24 #include "chrome/common/notification_service.h" 24 #include "chrome/common/notification_service.h"
25 #include "chrome/common/pref_names.h" 25 #include "chrome/common/pref_names.h"
26 #include "gfx/canvas.h" 26 #include "gfx/canvas.h"
27 #include "gfx/canvas_skia.h"
27 #include "grit/chromium_strings.h" 28 #include "grit/chromium_strings.h"
28 #include "grit/generated_resources.h" 29 #include "grit/generated_resources.h"
29 #include "gfx/skbitmap_operations.h" 30 #include "gfx/skbitmap_operations.h"
30 #include "grit/theme_resources.h" 31 #include "grit/theme_resources.h"
31 #include "views/controls/button/button_dropdown.h" 32 #include "views/controls/button/button_dropdown.h"
32 #include "views/focus/view_storage.h" 33 #include "views/focus/view_storage.h"
33 #include "views/widget/tooltip_manager.h" 34 #include "views/widget/tooltip_manager.h"
34 #include "views/window/non_client_view.h" 35 #include "views/window/non_client_view.h"
35 #include "views/window/window.h" 36 #include "views/window/window.h"
36 37
(...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after
656 ThemeProvider* tp = GetThemeProvider(); 657 ThemeProvider* tp = GetThemeProvider();
657 658
658 // We use different menu button images if the locale is right-to-left. 659 // We use different menu button images if the locale is right-to-left.
659 SkBitmap icon = *tp->GetBitmapNamed( 660 SkBitmap icon = *tp->GetBitmapNamed(
660 base::i18n::IsRTL() ? IDR_MENU_CHROME_RTL : IDR_MENU_CHROME); 661 base::i18n::IsRTL() ? IDR_MENU_CHROME_RTL : IDR_MENU_CHROME);
661 662
662 if (!Singleton<UpgradeDetector>::get()->notify_upgrade()) 663 if (!Singleton<UpgradeDetector>::get()->notify_upgrade())
663 return icon; 664 return icon;
664 665
665 // Draw the chrome app menu icon onto the canvas. 666 // Draw the chrome app menu icon onto the canvas.
666 scoped_ptr<gfx::Canvas> canvas( 667 scoped_ptr<gfx::CanvasSkia> canvas(
667 new gfx::Canvas(icon.width(), icon.height(), false)); 668 new gfx::CanvasSkia(icon.width(), icon.height(), false));
668 canvas->DrawBitmapInt(icon, 0, 0); 669 canvas->DrawBitmapInt(icon, 0, 0);
669 670
670 SkBitmap badge; 671 SkBitmap badge;
671 static bool has_faded_in = false; 672 static bool has_faded_in = false;
672 if (!has_faded_in) { 673 if (!has_faded_in) {
673 SkBitmap* dot = tp->GetBitmapNamed(IDR_UPGRADE_DOT_INACTIVE); 674 SkBitmap* dot = tp->GetBitmapNamed(IDR_UPGRADE_DOT_INACTIVE);
674 SkBitmap transparent; 675 SkBitmap transparent;
675 transparent.setConfig(dot->getConfig(), dot->width(), dot->height()); 676 transparent.setConfig(dot->getConfig(), dot->width(), dot->height());
676 transparent.allocPixels(); 677 transparent.allocPixels();
677 transparent.eraseARGB(0, 0, 0, 0); 678 transparent.eraseARGB(0, 0, 0, 0);
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
781 } 782 }
782 #endif 783 #endif
783 784
784 // Tell the menu button to activate, opening its pop-up menu. 785 // Tell the menu button to activate, opening its pop-up menu.
785 menu_button->Activate(); 786 menu_button->Activate();
786 787
787 #if defined(OS_WIN) 788 #if defined(OS_WIN)
788 SetToolbarFocus(NULL, menu_button); 789 SetToolbarFocus(NULL, menu_button);
789 #endif 790 #endif
790 } 791 }
OLDNEW
« no previous file with comments | « chrome/browser/views/theme_helpers.cc ('k') | chrome/renderer/webplugin_delegate_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698