OLD | NEW |
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/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 "base/keyboard_codes.h" | 8 #include "base/keyboard_codes.h" |
9 #include "chrome/browser/views/bubble_border.h" | 9 #include "chrome/browser/views/bubble_border.h" |
10 #include "chrome/browser/window_sizer.h" | 10 #include "chrome/browser/window_sizer.h" |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 // (e.g. calling SetChecked() on checkboxes is safe). | 257 // (e.g. calling SetChecked() on checkboxes is safe). |
258 SetContentsView(contents_view); | 258 SetContentsView(contents_view); |
259 // Adding |contents| as a child has to be done before we call | 259 // Adding |contents| as a child has to be done before we call |
260 // contents->GetPreferredSize() below, since some supplied views don't | 260 // contents->GetPreferredSize() below, since some supplied views don't |
261 // actually initialize themselves until they're added to a hierarchy. | 261 // actually initialize themselves until they're added to a hierarchy. |
262 contents_view->AddChildView(contents); | 262 contents_view->AddChildView(contents); |
263 | 263 |
264 // Calculate and set the bounds for all windows and views. | 264 // Calculate and set the bounds for all windows and views. |
265 gfx::Rect window_bounds; | 265 gfx::Rect window_bounds; |
266 | 266 |
267 bool prefer_arrow_on_right = | 267 bool prefer_arrow_on_right = delegate && |
268 (contents->UILayoutIsRightToLeft() == delegate->PreferOriginSideAnchor()); | 268 (contents->UILayoutIsRightToLeft() == delegate->PreferOriginSideAnchor()); |
269 | 269 |
270 #if defined(OS_WIN) | 270 #if defined(OS_WIN) |
271 border_.reset(new BorderWidget); | 271 border_.reset(new BorderWidget); |
272 // Initialize and position the border window. | 272 // Initialize and position the border window. |
273 window_bounds = border_->InitAndGetBounds(GetNativeView(), | 273 window_bounds = border_->InitAndGetBounds(GetNativeView(), |
274 position_relative_to, contents->GetPreferredSize(), | 274 position_relative_to, contents->GetPreferredSize(), |
275 prefer_arrow_on_right); | 275 prefer_arrow_on_right); |
276 | 276 |
277 // Make |contents| take up the entire contents view. | 277 // Make |contents| take up the entire contents view. |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 #endif | 347 #endif |
348 } | 348 } |
349 | 349 |
350 bool InfoBubble::AcceleratorPressed(const views::Accelerator& accelerator) { | 350 bool InfoBubble::AcceleratorPressed(const views::Accelerator& accelerator) { |
351 if (!delegate_ || delegate_->CloseOnEscape()) { | 351 if (!delegate_ || delegate_->CloseOnEscape()) { |
352 Close(true); | 352 Close(true); |
353 return true; | 353 return true; |
354 } | 354 } |
355 return false; | 355 return false; |
356 } | 356 } |
OLD | NEW |