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 std::wstring BubbleDelegate::accessible_name() { | 44 string16 BubbleDelegate::GetAccessibleName() { |
45 return L""; | 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, |
55 BubbleDelegate* delegate) { | 55 BubbleDelegate* delegate) { |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 // latter is displayed on top of the former. | 221 // latter is displayed on top of the former. |
222 views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP); | 222 views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP); |
223 params.parent = border_->GetNativeView(); | 223 params.parent = border_->GetNativeView(); |
224 params.native_widget = this; | 224 params.native_widget = this; |
225 GetWidget()->Init(params); | 225 GetWidget()->Init(params); |
226 | 226 |
227 if (fade_in) { | 227 if (fade_in) { |
228 border_->SetOpacity(0); | 228 border_->SetOpacity(0); |
229 GetWidget()->SetOpacity(0); | 229 GetWidget()->SetOpacity(0); |
230 } | 230 } |
231 SetWindowText(GetNativeView(), delegate_->accessible_name().c_str()); | 231 SetWindowText(GetNativeView(), delegate_->GetAccessibleName().c_str()); |
232 #elif defined(TOOLKIT_USES_GTK) | 232 #elif defined(TOOLKIT_USES_GTK) |
233 views::Widget::InitParams params(type_); | 233 views::Widget::InitParams params(type_); |
234 params.transparent = true; | 234 params.transparent = true; |
235 params.parent_widget = parent; | 235 params.parent_widget = parent; |
236 params.native_widget = this; | 236 params.native_widget = this; |
237 GetWidget()->Init(params); | 237 GetWidget()->Init(params); |
238 if (fade_in) | 238 if (fade_in) |
239 SetOpacity(0); | 239 SetOpacity(0); |
240 #if defined(OS_CHROMEOS) | 240 #if defined(OS_CHROMEOS) |
241 { | 241 { |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
439 animation_->Hide(); | 439 animation_->Hide(); |
440 } | 440 } |
441 | 441 |
442 bool Bubble::AcceleratorPressed(const views::Accelerator& accelerator) { | 442 bool Bubble::AcceleratorPressed(const views::Accelerator& accelerator) { |
443 if (!delegate_ || delegate_->CloseOnEscape()) { | 443 if (!delegate_ || delegate_->CloseOnEscape()) { |
444 DoClose(true); | 444 DoClose(true); |
445 return true; | 445 return true; |
446 } | 446 } |
447 return false; | 447 return false; |
448 } | 448 } |
OLD | NEW |