| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "chrome/browser/chromeos/login/helper.h" | 8 #include "chrome/browser/chromeos/login/helper.h" |
| 9 #include "grit/generated_resources.h" | 9 #include "grit/generated_resources.h" |
| 10 #include "grit/theme_resources.h" | 10 #include "grit/theme_resources.h" |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 const gfx::Rect& position_relative_to, | 108 const gfx::Rect& position_relative_to, |
| 109 BubbleBorder::ArrowLocation arrow_location, | 109 BubbleBorder::ArrowLocation arrow_location, |
| 110 SkBitmap* image, | 110 SkBitmap* image, |
| 111 const std::wstring& text, | 111 const std::wstring& text, |
| 112 const std::wstring& help, | 112 const std::wstring& help, |
| 113 MessageBubbleDelegate* delegate) { | 113 MessageBubbleDelegate* delegate) { |
| 114 // The bubble will be destroyed when it is closed. | 114 // The bubble will be destroyed when it is closed. |
| 115 MessageBubble* bubble = new MessageBubble( | 115 MessageBubble* bubble = new MessageBubble( |
| 116 views::WidgetGtk::TYPE_WINDOW, parent, image, text, help, true, delegate); | 116 views::WidgetGtk::TYPE_WINDOW, parent, image, text, help, true, delegate); |
| 117 bubble->Init(parent, position_relative_to, arrow_location, | 117 bubble->Init(parent, position_relative_to, arrow_location, |
| 118 bubble->text_->GetParent(), delegate); | 118 bubble->text_->parent(), delegate); |
| 119 return bubble; | 119 return bubble; |
| 120 } | 120 } |
| 121 | 121 |
| 122 // static | 122 // static |
| 123 MessageBubble* MessageBubble::ShowNoGrab( | 123 MessageBubble* MessageBubble::ShowNoGrab( |
| 124 views::Widget* parent, | 124 views::Widget* parent, |
| 125 const gfx::Rect& position_relative_to, | 125 const gfx::Rect& position_relative_to, |
| 126 BubbleBorder::ArrowLocation arrow_location, | 126 BubbleBorder::ArrowLocation arrow_location, |
| 127 SkBitmap* image, | 127 SkBitmap* image, |
| 128 const std::wstring& text, | 128 const std::wstring& text, |
| 129 const std::wstring& help, | 129 const std::wstring& help, |
| 130 MessageBubbleDelegate* delegate) { | 130 MessageBubbleDelegate* delegate) { |
| 131 // The bubble will be destroyed when it is closed. | 131 // The bubble will be destroyed when it is closed. |
| 132 MessageBubble* bubble = new MessageBubble( | 132 MessageBubble* bubble = new MessageBubble( |
| 133 views::WidgetGtk::TYPE_CHILD, parent, image, text, help, false, delegate); | 133 views::WidgetGtk::TYPE_CHILD, parent, image, text, help, false, delegate); |
| 134 bubble->Init(parent, position_relative_to, arrow_location, | 134 bubble->Init(parent, position_relative_to, arrow_location, |
| 135 bubble->text_->GetParent(), delegate); | 135 bubble->text_->parent(), delegate); |
| 136 return bubble; | 136 return bubble; |
| 137 } | 137 } |
| 138 | 138 |
| 139 void MessageBubble::IsActiveChanged() { | 139 void MessageBubble::IsActiveChanged() { |
| 140 // Active parent instead. | 140 // Active parent instead. |
| 141 if (parent_ && IsActive()) { | 141 if (parent_ && IsActive()) { |
| 142 gtk_window_present_with_time( | 142 gtk_window_present_with_time( |
| 143 GTK_WINDOW(static_cast<WidgetGtk*>(parent_)->GetNativeView()), | 143 GTK_WINDOW(static_cast<WidgetGtk*>(parent_)->GetNativeView()), |
| 144 gtk_get_current_event_time()); | 144 gtk_get_current_event_time()); |
| 145 } | 145 } |
| 146 } | 146 } |
| 147 | 147 |
| 148 void MessageBubble::DoGrab() { | 148 void MessageBubble::DoGrab() { |
| 149 if (grab_enabled_) | 149 if (grab_enabled_) |
| 150 WidgetGtk::DoGrab(); | 150 WidgetGtk::DoGrab(); |
| 151 } | 151 } |
| 152 | 152 |
| 153 void MessageBubble::Close() { | 153 void MessageBubble::Close() { |
| 154 parent_ = NULL; | 154 parent_ = NULL; |
| 155 InfoBubble::Close(); | 155 InfoBubble::Close(); |
| 156 } | 156 } |
| 157 | 157 |
| 158 } // namespace chromeos | 158 } // namespace chromeos |
| OLD | NEW |