| 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 "app/gfx/canvas.h" | 7 #include "app/gfx/canvas.h" |
| 8 #include "app/gfx/path.h" | 8 #include "app/gfx/path.h" |
| 9 #include "app/resource_bundle.h" | 9 #include "app/resource_bundle.h" |
| 10 #include "chrome/browser/browser_window.h" | 10 #include "chrome/browser/browser_window.h" |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 (win_util::GetWinVersion() < win_util::WINVERSION_XP) ? | 128 (win_util::GetWinVersion() < win_util::WINVERSION_XP) ? |
| 129 0 : CS_DROPSHADOW); | 129 0 : CS_DROPSHADOW); |
| 130 #endif | 130 #endif |
| 131 content_view_ = CreateContentView(content); | 131 content_view_ = CreateContentView(content); |
| 132 gfx::Rect bounds = | 132 gfx::Rect bounds = |
| 133 content_view_->CalculateWindowBoundsAndAjust(position_relative_to); | 133 content_view_->CalculateWindowBoundsAndAjust(position_relative_to); |
| 134 | 134 |
| 135 #if defined(OS_WIN) | 135 #if defined(OS_WIN) |
| 136 WidgetWin::Init(parent->GetNativeWindow(), bounds); | 136 WidgetWin::Init(parent->GetNativeWindow(), bounds); |
| 137 #else | 137 #else |
| 138 WidgetGtk::Init(GTK_WIDGET(parent->GetNativeWindow()), bounds, true); | 138 WidgetGtk::Init(GTK_WIDGET(parent->GetNativeWindow()), bounds); |
| 139 #endif | 139 #endif |
| 140 SetContentsView(content_view_); | 140 SetContentsView(content_view_); |
| 141 // The preferred size may differ when parented. Ask for the bounds again | 141 // The preferred size may differ when parented. Ask for the bounds again |
| 142 // and if they differ reset the bounds. | 142 // and if they differ reset the bounds. |
| 143 gfx::Rect parented_bounds = | 143 gfx::Rect parented_bounds = |
| 144 content_view_->CalculateWindowBoundsAndAjust(position_relative_to); | 144 content_view_->CalculateWindowBoundsAndAjust(position_relative_to); |
| 145 | 145 |
| 146 if (bounds != parented_bounds) { | 146 if (bounds != parented_bounds) { |
| 147 #if defined(OS_WIN) | 147 #if defined(OS_WIN) |
| 148 SetWindowPos(NULL, parented_bounds.x(), parented_bounds.y(), | 148 SetWindowPos(NULL, parented_bounds.x(), parented_bounds.y(), |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 448 x -= kArrowXOffset; | 448 x -= kArrowXOffset; |
| 449 else | 449 else |
| 450 x = x + kArrowXOffset - pref.width(); | 450 x = x + kArrowXOffset - pref.width(); |
| 451 if (IsTop()) { | 451 if (IsTop()) { |
| 452 y = position_relative_to.bottom() + kArrowToContentPadding; | 452 y = position_relative_to.bottom() + kArrowToContentPadding; |
| 453 } else { | 453 } else { |
| 454 y = position_relative_to.y() - kArrowToContentPadding - pref.height(); | 454 y = position_relative_to.y() - kArrowToContentPadding - pref.height(); |
| 455 } | 455 } |
| 456 return gfx::Rect(x, y, pref.width(), pref.height()); | 456 return gfx::Rect(x, y, pref.width(), pref.height()); |
| 457 } | 457 } |
| OLD | NEW |