OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/chrome_pages.h" | 5 #include "chrome/browser/ui/chrome_pages.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
363 original_profile, chrome::HOST_DESKTOP_TYPE_NATIVE)); | 363 original_profile, chrome::HOST_DESKTOP_TYPE_NATIVE)); |
364 browser = displayer->browser(); | 364 browser = displayer->browser(); |
365 } | 365 } |
366 | 366 |
367 signin_metrics::LogSigninSource(source); | 367 signin_metrics::LogSigninSource(source); |
368 | 368 |
369 // Since the app launcher is a separate application, it might steal focus | 369 // Since the app launcher is a separate application, it might steal focus |
370 // away from Chrome, and accidentally close the avatar bubble. The same will | 370 // away from Chrome, and accidentally close the avatar bubble. The same will |
371 // happen if we had to switch browser windows to show the sign in page. In | 371 // happen if we had to switch browser windows to show the sign in page. In |
372 // this case, fallback to the full-tab signin page. | 372 // this case, fallback to the full-tab signin page. |
373 if (switches::IsNewAvatarMenu() && | 373 bool should_show_in_avatar_bubble = |
Peter Kasting
2015/09/25 23:42:52
Nit: |show_avatar_bubble| is shorter and seems jus
anthonyvd
2015/09/29 20:23:15
Done.
| |
374 source != signin_metrics::SOURCE_APP_LAUNCHER && !switched_browser) { | 374 source != signin_metrics::SOURCE_APP_LAUNCHER && !switched_browser; |
375 #if defined(OS_CHROMEOS) | |
376 // ChromeOS doesn't have the Avatar Bubble. | |
Peter Kasting
2015/09/25 23:42:52
Nit: Don't capitalize Avatar Bubble
anthonyvd
2015/09/29 20:23:15
Done.
| |
377 should_show_in_avatar_bubble = false; | |
378 #endif | |
379 | |
380 if (should_show_in_avatar_bubble) { | |
375 browser->window()->ShowAvatarBubbleFromAvatarButton( | 381 browser->window()->ShowAvatarBubbleFromAvatarButton( |
376 BrowserWindow::AVATAR_BUBBLE_MODE_SIGNIN, | 382 BrowserWindow::AVATAR_BUBBLE_MODE_SIGNIN, |
377 signin::ManageAccountsParams()); | 383 signin::ManageAccountsParams()); |
378 } else { | 384 } else { |
379 NavigateToSingletonTab(browser, GURL(signin::GetPromoURL(source, false))); | 385 NavigateToSingletonTab(browser, GURL(signin::GetPromoURL(source, false))); |
380 DCHECK_GT(browser->tab_strip_model()->count(), 0); | 386 DCHECK_GT(browser->tab_strip_model()->count(), 0); |
381 } | 387 } |
382 } | 388 } |
383 | 389 |
384 void ShowBrowserSigninOrSettings( | 390 void ShowBrowserSigninOrSettings( |
385 Browser* browser, | 391 Browser* browser, |
386 signin_metrics::Source source) { | 392 signin_metrics::Source source) { |
387 Profile* original_profile = browser->profile()->GetOriginalProfile(); | 393 Profile* original_profile = browser->profile()->GetOriginalProfile(); |
388 SigninManagerBase* manager = | 394 SigninManagerBase* manager = |
389 SigninManagerFactory::GetForProfile(original_profile); | 395 SigninManagerFactory::GetForProfile(original_profile); |
390 DCHECK(manager->IsSigninAllowed()); | 396 DCHECK(manager->IsSigninAllowed()); |
391 if (manager->IsAuthenticated()) | 397 if (manager->IsAuthenticated()) |
392 ShowSettings(browser); | 398 ShowSettings(browser); |
393 else | 399 else |
394 ShowBrowserSignin(browser, source); | 400 ShowBrowserSignin(browser, source); |
395 } | 401 } |
396 #endif | 402 #endif |
397 | 403 |
398 } // namespace chrome | 404 } // namespace chrome |
OLD | NEW |