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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 #endif | 104 #endif |
105 } | 105 } |
106 } | 106 } |
107 | 107 |
108 void Bubble::AnimationProgressed(const ui::Animation* animation) { | 108 void Bubble::AnimationProgressed(const ui::Animation* animation) { |
109 // Set the opacity for the main contents window. | 109 // Set the opacity for the main contents window. |
110 unsigned char opacity = static_cast<unsigned char>( | 110 unsigned char opacity = static_cast<unsigned char>( |
111 animation_->GetCurrentValue() * 255); | 111 animation_->GetCurrentValue() * 255); |
112 #if defined(USE_AURA) | 112 #if defined(USE_AURA) |
113 // TODO(beng): | 113 // TODO(beng): |
| 114 (void)opacity; |
114 NOTIMPLEMENTED(); | 115 NOTIMPLEMENTED(); |
115 #elif defined(OS_WIN) | 116 #elif defined(OS_WIN) |
116 SetLayeredWindowAttributes(GetNativeView(), 0, | 117 SetLayeredWindowAttributes(GetNativeView(), 0, |
117 static_cast<byte>(opacity), LWA_ALPHA); | 118 static_cast<byte>(opacity), LWA_ALPHA); |
118 contents_->SchedulePaint(); | 119 contents_->SchedulePaint(); |
119 | 120 |
120 // Also fade in/out the bubble border window. | 121 // Also fade in/out the bubble border window. |
121 border_->SetOpacity(opacity); | 122 border_->SetOpacity(opacity); |
122 border_->border_contents()->SchedulePaint(); | 123 border_->border_contents()->SchedulePaint(); |
123 #else | 124 #else |
(...skipping 29 matching lines...) Expand all Loading... |
153 show_while_screen_is_locked_(false), | 154 show_while_screen_is_locked_(false), |
154 #endif | 155 #endif |
155 arrow_location_(views::BubbleBorder::NONE), | 156 arrow_location_(views::BubbleBorder::NONE), |
156 contents_(NULL), | 157 contents_(NULL), |
157 accelerator_registered_(false) { | 158 accelerator_registered_(false) { |
158 } | 159 } |
159 | 160 |
160 #if defined(OS_CHROMEOS) | 161 #if defined(OS_CHROMEOS) |
161 Bubble::Bubble(views::Widget::InitParams::Type type, | 162 Bubble::Bubble(views::Widget::InitParams::Type type, |
162 bool show_while_screen_is_locked) | 163 bool show_while_screen_is_locked) |
163 #if defined(TOUCH_UI) | 164 #if defined(USE_AURA) |
| 165 : views::NativeWidgetAura(new views::Widget), |
| 166 #elif defined(TOUCH_UI) |
164 : views::NativeWidgetViews(new views::Widget), | 167 : views::NativeWidgetViews(new views::Widget), |
165 #else | 168 #else |
166 : views::NativeWidgetGtk(new views::Widget), | 169 : views::NativeWidgetGtk(new views::Widget), |
167 #endif | 170 #endif |
168 border_contents_(NULL), | 171 border_contents_(NULL), |
169 delegate_(NULL), | 172 delegate_(NULL), |
170 show_status_(kOpen), | 173 show_status_(kOpen), |
171 fade_away_on_close_(false), | 174 fade_away_on_close_(false), |
172 type_(type), | 175 type_(type), |
173 show_while_screen_is_locked_(show_while_screen_is_locked), | 176 show_while_screen_is_locked_(show_while_screen_is_locked), |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
433 animation_->Hide(); | 436 animation_->Hide(); |
434 } | 437 } |
435 | 438 |
436 bool Bubble::AcceleratorPressed(const views::Accelerator& accelerator) { | 439 bool Bubble::AcceleratorPressed(const views::Accelerator& accelerator) { |
437 if (!delegate_ || delegate_->CloseOnEscape()) { | 440 if (!delegate_ || delegate_->CloseOnEscape()) { |
438 DoClose(true); | 441 DoClose(true); |
439 return true; | 442 return true; |
440 } | 443 } |
441 return false; | 444 return false; |
442 } | 445 } |
OLD | NEW |