Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/avatar_menu_button.h" | 5 #include "chrome/browser/ui/views/avatar_menu_button.h" |
| 6 | 6 |
| 7 #include "chrome/browser/ui/browser.h" | 7 #include "chrome/browser/ui/browser.h" |
| 8 #include "chrome/browser/ui/profile_menu_model.h" | 8 #include "chrome/browser/ui/profile_menu_model.h" |
| 9 #include "chrome/browser/ui/views/avatar_menu_bubble_view.h" | 9 #include "chrome/browser/ui/views/avatar_menu_bubble_view.h" |
| 10 #include "chrome/browser/ui/views/frame/browser_view.h" | 10 #include "chrome/browser/ui/views/frame/browser_view.h" |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 24 return static_cast<int>(x + 0.5); | 24 return static_cast<int>(x + 0.5); |
| 25 } | 25 } |
| 26 | 26 |
| 27 // The Windows 7 taskbar supports dynamic overlays and effects, we use this | 27 // The Windows 7 taskbar supports dynamic overlays and effects, we use this |
| 28 // to ovelay the avatar icon there. The overlay only applies if the taskbar | 28 // to ovelay the avatar icon there. The overlay only applies if the taskbar |
| 29 // is in "default large icon mode". This function is a best effort deal so | 29 // is in "default large icon mode". This function is a best effort deal so |
| 30 // we bail out silently at any error condition. | 30 // we bail out silently at any error condition. |
| 31 // See http://msdn.microsoft.com/en-us/library/dd391696(VS.85).aspx for | 31 // See http://msdn.microsoft.com/en-us/library/dd391696(VS.85).aspx for |
| 32 // more information. | 32 // more information. |
| 33 void DrawTaskBarDecoration(const Browser* browser, const SkBitmap* bitmap) { | 33 void DrawTaskBarDecoration(const Browser* browser, const SkBitmap* bitmap) { |
| 34 #if defined(OS_WIN) | 34 #if defined(OS_WIN) && !defined(USE_AURA) |
| 35 if (base::win::GetVersion() < base::win::VERSION_WIN7) | 35 if (base::win::GetVersion() < base::win::VERSION_WIN7) |
| 36 return; | 36 return; |
| 37 // During destruction of the browser frame, we might not have a window | 37 // During destruction of the browser frame, we might not have a window |
| 38 // so the taksbar button will be removed by windows anyway. | 38 // so the taksbar button will be removed by windows anyway. |
| 39 BrowserWindow* bw = browser->window(); | 39 BrowserWindow* bw = browser->window(); |
| 40 if (!bw) | 40 if (!bw) |
| 41 return; | 41 return; |
| 42 gfx::NativeWindow window = bw->GetNativeHandle(); | 42 gfx::NativeWindow window = bw->GetNativeHandle(); |
| 43 if (!window) | 43 if (!window) |
| 44 return; | 44 return; |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 55 *bitmap, | 55 *bitmap, |
| 56 skia::ImageOperations::RESIZE_LANCZOS3, | 56 skia::ImageOperations::RESIZE_LANCZOS3, |
| 57 16, 16); | 57 16, 16); |
| 58 icon = IconUtil::CreateHICONFromSkBitmap(sk_icon); | 58 icon = IconUtil::CreateHICONFromSkBitmap(sk_icon); |
| 59 if (!icon) | 59 if (!icon) |
| 60 return; | 60 return; |
| 61 } | 61 } |
| 62 taskbar->SetOverlayIcon(window, icon, L""); | 62 taskbar->SetOverlayIcon(window, icon, L""); |
| 63 if (icon) | 63 if (icon) |
| 64 DestroyIcon(icon); | 64 DestroyIcon(icon); |
| 65 #endif | 65 #endif |
|
sky
2011/09/06 17:22:48
#else NOTIMPLEMNETED?
| |
| 66 } | 66 } |
| 67 | 67 |
| 68 AvatarMenuButton::AvatarMenuButton(Browser* browser, bool has_menu) | 68 AvatarMenuButton::AvatarMenuButton(Browser* browser, bool has_menu) |
| 69 : MenuButton(NULL, std::wstring(), this, false), | 69 : MenuButton(NULL, std::wstring(), this, false), |
| 70 browser_(browser), | 70 browser_(browser), |
| 71 has_menu_(has_menu), | 71 has_menu_(has_menu), |
| 72 set_taskbar_decoration_(false) { | 72 set_taskbar_decoration_(false) { |
| 73 // In RTL mode, the avatar icon should be looking the opposite direction. | 73 // In RTL mode, the avatar icon should be looking the opposite direction. |
| 74 EnableCanvasFlippingForRTLUI(true); | 74 EnableCanvasFlippingForRTLUI(true); |
| 75 } | 75 } |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 136 views::View::ConvertPointToScreen(this, &origin); | 136 views::View::ConvertPointToScreen(this, &origin); |
| 137 gfx::Rect bounds(0, 0, width(), height()); | 137 gfx::Rect bounds(0, 0, width(), height()); |
| 138 bounds.set_origin(origin); | 138 bounds.set_origin(origin); |
| 139 | 139 |
| 140 AvatarMenuBubbleView* bubble_view = new AvatarMenuBubbleView(browser_); | 140 AvatarMenuBubbleView* bubble_view = new AvatarMenuBubbleView(browser_); |
| 141 // Bubble::Show() takes ownership of the view. | 141 // Bubble::Show() takes ownership of the view. |
| 142 Bubble::Show(browser_view->GetWidget(), bounds, | 142 Bubble::Show(browser_view->GetWidget(), bounds, |
| 143 views::BubbleBorder::TOP_LEFT, | 143 views::BubbleBorder::TOP_LEFT, |
| 144 bubble_view, bubble_view); | 144 bubble_view, bubble_view); |
| 145 } | 145 } |
| OLD | NEW |