| 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/chromeos/login/message_bubble.h" | 5 #include "chrome/browser/chromeos/login/message_bubble.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 views::BubbleBorder::ArrowLocation arrow_location, | 143 views::BubbleBorder::ArrowLocation arrow_location, |
| 144 SkBitmap* image, | 144 SkBitmap* image, |
| 145 const std::wstring& text, | 145 const std::wstring& text, |
| 146 const std::vector<std::wstring>& links, | 146 const std::vector<std::wstring>& links, |
| 147 MessageBubbleDelegate* delegate) { | 147 MessageBubbleDelegate* delegate) { |
| 148 // The bubble will be destroyed when it is closed. | 148 // The bubble will be destroyed when it is closed. |
| 149 MessageBubble* bubble = new MessageBubble( | 149 MessageBubble* bubble = new MessageBubble( |
| 150 views::Widget::InitParams::TYPE_POPUP, parent, image, text, links, | 150 views::Widget::InitParams::TYPE_POPUP, parent, image, text, links, |
| 151 true, delegate); | 151 true, delegate); |
| 152 bubble->InitBubble(parent, position_relative_to, arrow_location, | 152 bubble->InitBubble(parent, position_relative_to, arrow_location, |
| 153 views::BubbleBorder::ALIGN_ARROW_TO_MID_ANCHOR, |
| 153 bubble->text_->parent(), delegate); | 154 bubble->text_->parent(), delegate); |
| 154 return bubble; | 155 return bubble; |
| 155 } | 156 } |
| 156 | 157 |
| 157 // static | 158 // static |
| 158 MessageBubble* MessageBubble::ShowNoGrab( | 159 MessageBubble* MessageBubble::ShowNoGrab( |
| 159 views::Widget* parent, | 160 views::Widget* parent, |
| 160 const gfx::Rect& position_relative_to, | 161 const gfx::Rect& position_relative_to, |
| 161 views::BubbleBorder::ArrowLocation arrow_location, | 162 views::BubbleBorder::ArrowLocation arrow_location, |
| 162 SkBitmap* image, | 163 SkBitmap* image, |
| 163 const std::wstring& text, | 164 const std::wstring& text, |
| 164 const std::wstring& help, | 165 const std::wstring& help, |
| 165 MessageBubbleDelegate* delegate) { | 166 MessageBubbleDelegate* delegate) { |
| 166 std::vector<std::wstring> links; | 167 std::vector<std::wstring> links; |
| 167 if (!help.empty()) | 168 if (!help.empty()) |
| 168 links.push_back(help); | 169 links.push_back(help); |
| 169 // The bubble will be destroyed when it is closed. | 170 // The bubble will be destroyed when it is closed. |
| 170 MessageBubble* bubble = new MessageBubble( | 171 MessageBubble* bubble = new MessageBubble( |
| 171 views::Widget::InitParams::TYPE_CONTROL, parent, image, text, links, | 172 views::Widget::InitParams::TYPE_CONTROL, parent, image, text, links, |
| 172 false, delegate); | 173 false, delegate); |
| 173 bubble->InitBubble(parent, position_relative_to, arrow_location, | 174 bubble->InitBubble(parent, position_relative_to, arrow_location, |
| 175 views::BubbleBorder::ALIGN_ARROW_TO_MID_ANCHOR, |
| 174 bubble->text_->parent(), delegate); | 176 bubble->text_->parent(), delegate); |
| 175 return bubble; | 177 return bubble; |
| 176 } | 178 } |
| 177 | 179 |
| 178 #if !defined(TOUCH_UI) && defined(TOOLKIT_USES_GTK) | 180 #if !defined(TOUCH_UI) && defined(TOOLKIT_USES_GTK) |
| 179 // TODO(saintlou): Unclear if we need this for the !gtk case. | 181 // TODO(saintlou): Unclear if we need this for the !gtk case. |
| 180 void MessageBubble::OnActiveChanged() { | 182 void MessageBubble::OnActiveChanged() { |
| 181 if (parent_ && IsActive()) { | 183 if (parent_ && IsActive()) { |
| 182 // Show the parent. | 184 // Show the parent. |
| 183 gtk_window_present_with_time(parent_->GetNativeWindow(), | 185 gtk_window_present_with_time(parent_->GetNativeWindow(), |
| (...skipping 15 matching lines...) Expand all Loading... |
| 199 #if !defined(TOUCH_UI) && defined(TOOLKIT_USES_GTK) | 201 #if !defined(TOUCH_UI) && defined(TOOLKIT_USES_GTK) |
| 200 gboolean MessageBubble::OnButtonPress(GtkWidget* widget, | 202 gboolean MessageBubble::OnButtonPress(GtkWidget* widget, |
| 201 GdkEventButton* event) { | 203 GdkEventButton* event) { |
| 202 NativeWidgetGtk::OnButtonPress(widget, event); | 204 NativeWidgetGtk::OnButtonPress(widget, event); |
| 203 // Never propagate event to parent. | 205 // Never propagate event to parent. |
| 204 return true; | 206 return true; |
| 205 } | 207 } |
| 206 #endif | 208 #endif |
| 207 | 209 |
| 208 } // namespace chromeos | 210 } // namespace chromeos |
| OLD | NEW |