| 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/color_utils.h" | 8 #include "app/gfx/color_utils.h" |
| 9 #include "app/gfx/path.h" | 9 #include "app/gfx/path.h" |
| 10 #include "chrome/browser/window_sizer.h" | 10 #include "chrome/browser/window_sizer.h" |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 contents_view->SetLayoutManager(new views::FillLayout); | 259 contents_view->SetLayoutManager(new views::FillLayout); |
| 260 | 260 |
| 261 // Paint the background color behind the contents. | 261 // Paint the background color behind the contents. |
| 262 contents_view->set_background( | 262 contents_view->set_background( |
| 263 views::Background::CreateSolidBackground(kBackgroundColor)); | 263 views::Background::CreateSolidBackground(kBackgroundColor)); |
| 264 #else | 264 #else |
| 265 // Create a view to paint the border and background. | 265 // Create a view to paint the border and background. |
| 266 BorderContents* border_contents = new BorderContents; | 266 BorderContents* border_contents = new BorderContents; |
| 267 gfx::Rect contents_bounds; | 267 gfx::Rect contents_bounds; |
| 268 border_contents->InitAndGetBounds(position_relative_to, | 268 border_contents->InitAndGetBounds(position_relative_to, |
| 269 contents->GetPreferredSize(), is_rtl, &contents_bounds, &window_bounds); | 269 contents->GetPreferredSize(), contents->UILayoutIsRightToLeft(), |
| 270 &contents_bounds, &window_bounds); |
| 270 // This new view must be added before |contents| so it will paint under it. | 271 // This new view must be added before |contents| so it will paint under it. |
| 271 contents_view->AddChildView(border_contents, 0); | 272 contents_view->AddChildView(0, border_contents); |
| 272 | 273 |
| 273 // |contents_view| has no layout manager, so we have to explicitly position | 274 // |contents_view| has no layout manager, so we have to explicitly position |
| 274 // its children. | 275 // its children. |
| 275 border_contents->SetBounds(gfx::Rect(gfx::Point(), window_bounds.size())); | 276 border_contents->SetBounds(gfx::Rect(gfx::Point(), window_bounds.size())); |
| 276 contents->SetBounds(contents_bounds); | 277 contents->SetBounds(contents_bounds); |
| 277 #endif | 278 #endif |
| 278 SetBounds(window_bounds); | 279 SetBounds(window_bounds); |
| 279 | 280 |
| 280 #if defined(OS_WIN) | 281 #if defined(OS_WIN) |
| 281 // Register the Escape accelerator for closing. | 282 // Register the Escape accelerator for closing. |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 #endif | 325 #endif |
| 325 } | 326 } |
| 326 | 327 |
| 327 bool InfoBubble::AcceleratorPressed(const views::Accelerator& accelerator) { | 328 bool InfoBubble::AcceleratorPressed(const views::Accelerator& accelerator) { |
| 328 if (!delegate_ || delegate_->CloseOnEscape()) { | 329 if (!delegate_ || delegate_->CloseOnEscape()) { |
| 329 Close(true); | 330 Close(true); |
| 330 return true; | 331 return true; |
| 331 } | 332 } |
| 332 return false; | 333 return false; |
| 333 } | 334 } |
| OLD | NEW |