| 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" |
| 11 #include "chrome/browser/download/download_shelf.h" | 11 #include "chrome/browser/download/download_shelf.h" |
| 12 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
| 13 #include "chrome/browser/profiles/profile_manager.h" | 13 #include "chrome/browser/profiles/profile_manager.h" |
| 14 #include "chrome/browser/ui/browser.h" | 14 #include "chrome/browser/ui/browser.h" |
| 15 #include "chrome/browser/ui/browser_finder.h" | 15 #include "chrome/browser/ui/browser_finder.h" |
| 16 #include "chrome/browser/ui/browser_navigator.h" | 16 #include "chrome/browser/ui/browser_navigator.h" |
| 17 #include "chrome/browser/ui/browser_window.h" | 17 #include "chrome/browser/ui/browser_window.h" |
| 18 #include "chrome/browser/ui/extensions/app_launch_params.h" | 18 #include "chrome/browser/ui/extensions/app_launch_params.h" |
| 19 #include "chrome/browser/ui/extensions/application_launch.h" | 19 #include "chrome/browser/ui/extensions/application_launch.h" |
| 20 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" | 20 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" |
| 21 #include "chrome/browser/ui/settings_window_manager.h" | 21 #include "chrome/browser/ui/settings_window_manager.h" |
| 22 #include "chrome/browser/ui/singleton_tabs.h" | 22 #include "chrome/browser/ui/singleton_tabs.h" |
| 23 #include "chrome/browser/ui/sync/one_click_signin_helper.h" |
| 23 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 24 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 24 #include "chrome/browser/ui/webui/options/content_settings_handler.h" | 25 #include "chrome/browser/ui/webui/options/content_settings_handler.h" |
| 25 #include "chrome/common/chrome_switches.h" | 26 #include "chrome/common/chrome_switches.h" |
| 26 #include "chrome/common/url_constants.h" | 27 #include "chrome/common/url_constants.h" |
| 28 #include "components/signin/core/common/profile_management_switches.h" |
| 27 #include "content/public/browser/user_metrics.h" | 29 #include "content/public/browser/user_metrics.h" |
| 28 #include "content/public/browser/web_contents.h" | 30 #include "content/public/browser/web_contents.h" |
| 29 #include "extensions/common/constants.h" | 31 #include "extensions/common/constants.h" |
| 30 #include "google_apis/gaia/gaia_urls.h" | 32 #include "google_apis/gaia/gaia_urls.h" |
| 31 #include "net/base/url_util.h" | 33 #include "net/base/url_util.h" |
| 32 #include "ui/base/window_open_disposition.h" | 34 #include "ui/base/window_open_disposition.h" |
| 33 | 35 |
| 34 #if defined(OS_WIN) | 36 #if defined(OS_WIN) |
| 35 #include "chrome/browser/enumerate_modules_model_win.h" | 37 #include "chrome/browser/enumerate_modules_model_win.h" |
| 36 #endif | 38 #endif |
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 // If the browser's profile is an incognito profile, make sure to use | 342 // If the browser's profile is an incognito profile, make sure to use |
| 341 // a browser window from the original profile. The user cannot sign in | 343 // a browser window from the original profile. The user cannot sign in |
| 342 // from an incognito window. | 344 // from an incognito window. |
| 343 scoped_ptr<ScopedTabbedBrowserDisplayer> displayer; | 345 scoped_ptr<ScopedTabbedBrowserDisplayer> displayer; |
| 344 if (browser->profile()->IsOffTheRecord()) { | 346 if (browser->profile()->IsOffTheRecord()) { |
| 345 displayer.reset(new ScopedTabbedBrowserDisplayer( | 347 displayer.reset(new ScopedTabbedBrowserDisplayer( |
| 346 original_profile, chrome::HOST_DESKTOP_TYPE_NATIVE)); | 348 original_profile, chrome::HOST_DESKTOP_TYPE_NATIVE)); |
| 347 browser = displayer->browser(); | 349 browser = displayer->browser(); |
| 348 } | 350 } |
| 349 | 351 |
| 350 NavigateToSingletonTab(browser, GURL(signin::GetPromoURL(source, false))); | 352 OneClickSigninHelper::LogHistogramSourceValue(source); |
| 351 DCHECK_GT(browser->tab_strip_model()->count(), 0); | 353 |
| 354 if (switches::IsNewAvatarMenu()) { |
| 355 browser->window()->ShowAvatarBubbleFromAvatarButton( |
| 356 BrowserWindow::AVATAR_BUBBLE_MODE_SIGNIN, |
| 357 signin::ManageAccountsParams()); |
| 358 } else { |
| 359 NavigateToSingletonTab(browser, GURL(signin::GetPromoURL(source, false))); |
| 360 DCHECK_GT(browser->tab_strip_model()->count(), 0); |
| 361 } |
| 352 } | 362 } |
| 353 } | 363 } |
| 354 #endif | 364 #endif |
| 355 | 365 |
| 356 } // namespace chrome | 366 } // namespace chrome |
| OLD | NEW |