OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/passwords/manage_passwords_bubble_view.h" | 5 #include "chrome/browser/ui/views/passwords/manage_passwords_bubble_view.h" |
6 | 6 |
7 #include "chrome/browser/chrome_notification_types.h" | 7 #include "chrome/browser/chrome_notification_types.h" |
8 #include "chrome/browser/ui/browser.h" | 8 #include "chrome/browser/ui/browser.h" |
9 #include "chrome/browser/ui/browser_finder.h" | 9 #include "chrome/browser/ui/browser_finder.h" |
10 #include "chrome/browser/ui/fullscreen/fullscreen_controller.h" | 10 #include "chrome/browser/ui/fullscreen/fullscreen_controller.h" |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 ui::ResourceBundle::SmallFont)); | 159 ui::ResourceBundle::SmallFont)); |
160 layout->StartRow(0, SINGLE_VIEW_COLUMN_SET); | 160 layout->StartRow(0, SINGLE_VIEW_COLUMN_SET); |
161 layout->AddView(text_label); | 161 layout->AddView(text_label); |
162 } | 162 } |
163 | 163 |
164 } // namespace | 164 } // namespace |
165 | 165 |
166 | 166 |
167 // Globals -------------------------------------------------------------------- | 167 // Globals -------------------------------------------------------------------- |
168 | 168 |
| 169 #if !defined(OS_MACOSX) |
169 namespace chrome { | 170 namespace chrome { |
170 | 171 |
171 void ShowManagePasswordsBubble(content::WebContents* web_contents) { | 172 void ShowManagePasswordsBubble(content::WebContents* web_contents) { |
172 if (ManagePasswordsBubbleView::IsShowing()) { | 173 if (ManagePasswordsBubbleView::IsShowing()) { |
173 // The bubble is currently shown for some other tab. We should close it now | 174 // The bubble is currently shown for some other tab. We should close it now |
174 // and open for |web_contents|. | 175 // and open for |web_contents|. |
175 ManagePasswordsBubbleView::CloseBubble(); | 176 ManagePasswordsBubbleView::CloseBubble(); |
176 } | 177 } |
177 ManagePasswordsUIController* controller = | 178 ManagePasswordsUIController* controller = |
178 ManagePasswordsUIController::FromWebContents(web_contents); | 179 ManagePasswordsUIController::FromWebContents(web_contents); |
179 ManagePasswordsBubbleView::ShowBubble( | 180 ManagePasswordsBubbleView::ShowBubble( |
180 web_contents, | 181 web_contents, |
181 password_manager::ui::IsAutomaticDisplayState(controller->state()) | 182 password_manager::ui::IsAutomaticDisplayState(controller->state()) |
182 ? ManagePasswordsBubbleView::AUTOMATIC | 183 ? ManagePasswordsBubbleView::AUTOMATIC |
183 : ManagePasswordsBubbleView::USER_ACTION); | 184 : ManagePasswordsBubbleView::USER_ACTION); |
184 } | 185 } |
185 | 186 |
186 void CloseManagePasswordsBubble(content::WebContents* web_contents) { | 187 void CloseManagePasswordsBubble(content::WebContents* web_contents) { |
187 if (!ManagePasswordsBubbleView::IsShowing()) | 188 if (!ManagePasswordsBubbleView::IsShowing()) |
188 return; | 189 return; |
189 content::WebContents* bubble_web_contents = | 190 content::WebContents* bubble_web_contents = |
190 ManagePasswordsBubbleView::manage_password_bubble()->web_contents(); | 191 ManagePasswordsBubbleView::manage_password_bubble()->web_contents(); |
191 if (web_contents == bubble_web_contents) | 192 if (web_contents == bubble_web_contents) |
192 ManagePasswordsBubbleView::CloseBubble(); | 193 ManagePasswordsBubbleView::CloseBubble(); |
193 } | 194 } |
194 | 195 |
195 } // namespace chrome | 196 } // namespace chrome |
196 | 197 #endif |
197 | 198 |
198 // ManagePasswordsBubbleView::AccountChooserView ------------------------------ | 199 // ManagePasswordsBubbleView::AccountChooserView ------------------------------ |
199 | 200 |
200 // A view offering the user the ability to choose credentials for | 201 // A view offering the user the ability to choose credentials for |
201 // authentication. Contains a list of CredentialsItemView, along with a | 202 // authentication. Contains a list of CredentialsItemView, along with a |
202 // "Cancel" button. | 203 // "Cancel" button. |
203 class ManagePasswordsBubbleView::AccountChooserView | 204 class ManagePasswordsBubbleView::AccountChooserView |
204 : public views::View, | 205 : public views::View, |
205 public views::ButtonListener { | 206 public views::ButtonListener { |
206 public: | 207 public: |
(...skipping 820 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1027 } | 1028 } |
1028 | 1029 |
1029 void ManagePasswordsBubbleView::Observe( | 1030 void ManagePasswordsBubbleView::Observe( |
1030 int type, | 1031 int type, |
1031 const content::NotificationSource& source, | 1032 const content::NotificationSource& source, |
1032 const content::NotificationDetails& details) { | 1033 const content::NotificationDetails& details) { |
1033 DCHECK_EQ(type, chrome::NOTIFICATION_FULLSCREEN_CHANGED); | 1034 DCHECK_EQ(type, chrome::NOTIFICATION_FULLSCREEN_CHANGED); |
1034 GetWidget()->SetVisibilityAnimationTransition(views::Widget::ANIMATE_NONE); | 1035 GetWidget()->SetVisibilityAnimationTransition(views::Widget::ANIMATE_NONE); |
1035 CloseBubble(); | 1036 CloseBubble(); |
1036 } | 1037 } |
OLD | NEW |