OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/info_bubble.h" | 5 #include "chrome/browser/views/info_bubble.h" |
6 | 6 |
7 #include "base/win_util.h" | 7 #include "base/win_util.h" |
8 #include "chrome/app/theme/theme_resources.h" | 8 #include "chrome/app/theme/theme_resources.h" |
9 #include "chrome/browser/browser_window.h" | 9 #include "chrome/browser/browser_window.h" |
10 #include "chrome/browser/views/frame/browser_view.h" | 10 #include "chrome/browser/views/frame/browser_view.h" |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 InfoBubble::~InfoBubble() { | 84 InfoBubble::~InfoBubble() { |
85 } | 85 } |
86 | 86 |
87 void InfoBubble::Init(HWND parent_hwnd, | 87 void InfoBubble::Init(HWND parent_hwnd, |
88 const gfx::Rect& position_relative_to, | 88 const gfx::Rect& position_relative_to, |
89 views::View* content) { | 89 views::View* content) { |
90 HWND owning_frame_hwnd = GetAncestor(parent_hwnd, GA_ROOTOWNER); | 90 HWND owning_frame_hwnd = GetAncestor(parent_hwnd, GA_ROOTOWNER); |
91 // We should always have a frame, but there was a bug elsewhere that | 91 // We should always have a frame, but there was a bug elsewhere that |
92 // made it possible for the frame to be NULL, so we have the check. If | 92 // made it possible for the frame to be NULL, so we have the check. If |
93 // you hit this, file a bug. | 93 // you hit this, file a bug. |
94 DCHECK(BrowserView::GetBrowserWindowForHWND(owning_frame_hwnd)); | 94 DCHECK(BrowserView::GetBrowserViewForHWND(owning_frame_hwnd)); |
95 parent_ = reinterpret_cast<views::Window*>(win_util::GetWindowUserData( | 95 parent_ = reinterpret_cast<views::Window*>(win_util::GetWindowUserData( |
96 owning_frame_hwnd)); | 96 owning_frame_hwnd)); |
97 parent_->DisableInactiveRendering(true); | 97 parent_->DisableInactiveRendering(true); |
98 | 98 |
99 if (kInfoBubbleCornerTopLeft == NULL) { | 99 if (kInfoBubbleCornerTopLeft == NULL) { |
100 kInfoBubbleCornerTopLeft = ResourceBundle::GetSharedInstance() | 100 kInfoBubbleCornerTopLeft = ResourceBundle::GetSharedInstance() |
101 .GetBitmapNamed(IDR_INFO_BUBBLE_CORNER_TOP_LEFT); | 101 .GetBitmapNamed(IDR_INFO_BUBBLE_CORNER_TOP_LEFT); |
102 kInfoBubbleCornerTopRight = ResourceBundle::GetSharedInstance() | 102 kInfoBubbleCornerTopRight = ResourceBundle::GetSharedInstance() |
103 .GetBitmapNamed(IDR_INFO_BUBBLE_CORNER_TOP_RIGHT); | 103 .GetBitmapNamed(IDR_INFO_BUBBLE_CORNER_TOP_RIGHT); |
104 kInfoBubbleCornerBottomLeft = ResourceBundle::GetSharedInstance() | 104 kInfoBubbleCornerBottomLeft = ResourceBundle::GetSharedInstance() |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
417 x -= kArrowXOffset; | 417 x -= kArrowXOffset; |
418 else | 418 else |
419 x = x + kArrowXOffset - pref.width(); | 419 x = x + kArrowXOffset - pref.width(); |
420 if (IsTop()) { | 420 if (IsTop()) { |
421 y = position_relative_to.bottom() + kArrowToContentPadding; | 421 y = position_relative_to.bottom() + kArrowToContentPadding; |
422 } else { | 422 } else { |
423 y = position_relative_to.y() - kArrowToContentPadding - pref.height(); | 423 y = position_relative_to.y() - kArrowToContentPadding - pref.height(); |
424 } | 424 } |
425 return gfx::Rect(x, y, pref.width(), pref.height()); | 425 return gfx::Rect(x, y, pref.width(), pref.height()); |
426 } | 426 } |
OLD | NEW |