| 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/bubble/bubble.h" | 5 #include "chrome/browser/ui/views/bubble/bubble.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "chrome/browser/ui/views/bubble/border_contents.h" | 9 #include "chrome/browser/ui/views/bubble/border_contents.h" |
| 10 #include "chrome/common/chrome_notification_types.h" | 10 #include "chrome/common/chrome_notification_types.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 #if defined(OS_WIN) && !defined(USE_AURA) | 34 #if defined(OS_WIN) && !defined(USE_AURA) |
| 35 const SkColor Bubble::kBackgroundColor = | 35 const SkColor Bubble::kBackgroundColor = |
| 36 color_utils::GetSysSkColor(COLOR_WINDOW); | 36 color_utils::GetSysSkColor(COLOR_WINDOW); |
| 37 #else | 37 #else |
| 38 // TODO(beng): source from theme provider. | 38 // TODO(beng): source from theme provider. |
| 39 const SkColor Bubble::kBackgroundColor = SK_ColorWHITE; | 39 const SkColor Bubble::kBackgroundColor = SK_ColorWHITE; |
| 40 #endif | 40 #endif |
| 41 | 41 |
| 42 // BubbleDelegate --------------------------------------------------------- | 42 // BubbleDelegate --------------------------------------------------------- |
| 43 | 43 |
| 44 string16 BubbleDelegate::accessible_name() { | 44 string16 BubbleDelegate::GetAccessibleName() { |
| 45 return string16(); | 45 return string16(); |
| 46 } | 46 } |
| 47 | 47 |
| 48 // Bubble ----------------------------------------------------------------- | 48 // Bubble ----------------------------------------------------------------- |
| 49 | 49 |
| 50 // static | 50 // static |
| 51 Bubble* Bubble::Show(views::Widget* parent, | 51 Bubble* Bubble::Show(views::Widget* parent, |
| 52 const gfx::Rect& position_relative_to, | 52 const gfx::Rect& position_relative_to, |
| 53 views::BubbleBorder::ArrowLocation arrow_location, | 53 views::BubbleBorder::ArrowLocation arrow_location, |
| 54 views::View* contents, | 54 views::View* contents, |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 // latter is displayed on top of the former. | 222 // latter is displayed on top of the former. |
| 223 views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP); | 223 views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP); |
| 224 params.parent = border_->GetNativeView(); | 224 params.parent = border_->GetNativeView(); |
| 225 params.native_widget = this; | 225 params.native_widget = this; |
| 226 GetWidget()->Init(params); | 226 GetWidget()->Init(params); |
| 227 | 227 |
| 228 if (fade_in) { | 228 if (fade_in) { |
| 229 border_->SetOpacity(0); | 229 border_->SetOpacity(0); |
| 230 GetWidget()->SetOpacity(0); | 230 GetWidget()->SetOpacity(0); |
| 231 } | 231 } |
| 232 SetWindowText(GetNativeView(), delegate_->accessible_name().c_str()); | 232 SetWindowText(GetNativeView(), delegate_->GetAccessibleName().c_str()); |
| 233 #elif defined(TOOLKIT_USES_GTK) | 233 #elif defined(TOOLKIT_USES_GTK) |
| 234 views::Widget::InitParams params(type_); | 234 views::Widget::InitParams params(type_); |
| 235 params.transparent = true; | 235 params.transparent = true; |
| 236 params.parent_widget = parent; | 236 params.parent_widget = parent; |
| 237 params.native_widget = this; | 237 params.native_widget = this; |
| 238 GetWidget()->Init(params); | 238 GetWidget()->Init(params); |
| 239 if (fade_in) | 239 if (fade_in) |
| 240 SetOpacity(0); | 240 SetOpacity(0); |
| 241 #if defined(OS_CHROMEOS) | 241 #if defined(OS_CHROMEOS) |
| 242 { | 242 { |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 441 animation_->Hide(); | 441 animation_->Hide(); |
| 442 } | 442 } |
| 443 | 443 |
| 444 bool Bubble::AcceleratorPressed(const views::Accelerator& accelerator) { | 444 bool Bubble::AcceleratorPressed(const views::Accelerator& accelerator) { |
| 445 if (!delegate_ || delegate_->CloseOnEscape()) { | 445 if (!delegate_ || delegate_->CloseOnEscape()) { |
| 446 DoClose(true); | 446 DoClose(true); |
| 447 return true; | 447 return true; |
| 448 } | 448 } |
| 449 return false; | 449 return false; |
| 450 } | 450 } |
| OLD | NEW |