| 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/first_run/first_run.h" | 5 #include "chrome/browser/first_run/first_run.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 #include "chrome/browser/profiles/profile_manager.h" | 27 #include "chrome/browser/profiles/profile_manager.h" |
| 28 #include "chrome/browser/search_engines/template_url_service.h" | 28 #include "chrome/browser/search_engines/template_url_service.h" |
| 29 #include "chrome/browser/search_engines/template_url_service_factory.h" | 29 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| 30 #include "chrome/browser/shell_integration.h" | 30 #include "chrome/browser/shell_integration.h" |
| 31 #include "chrome/browser/ui/browser.h" | 31 #include "chrome/browser/ui/browser.h" |
| 32 #include "chrome/browser/ui/browser_finder.h" | 32 #include "chrome/browser/ui/browser_finder.h" |
| 33 #include "chrome/browser/ui/browser_tabstrip.h" | 33 #include "chrome/browser/ui/browser_tabstrip.h" |
| 34 #include "chrome/browser/ui/global_error/global_error_service.h" | 34 #include "chrome/browser/ui/global_error/global_error_service.h" |
| 35 #include "chrome/browser/ui/global_error/global_error_service_factory.h" | 35 #include "chrome/browser/ui/global_error/global_error_service_factory.h" |
| 36 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" | 36 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" |
| 37 #include "chrome/browser/ui/webui/sync_promo/sync_promo_ui.h" |
| 37 #include "chrome/common/chrome_paths.h" | 38 #include "chrome/common/chrome_paths.h" |
| 38 #include "chrome/common/chrome_switches.h" | 39 #include "chrome/common/chrome_switches.h" |
| 39 #include "chrome/common/pref_names.h" | 40 #include "chrome/common/pref_names.h" |
| 40 #include "chrome/common/startup_metric_utils.h" | 41 #include "chrome/common/startup_metric_utils.h" |
| 41 #include "chrome/common/url_constants.h" | 42 #include "chrome/common/url_constants.h" |
| 42 #include "chrome/installer/util/master_preferences.h" | 43 #include "chrome/installer/util/master_preferences.h" |
| 43 #include "chrome/installer/util/master_preferences_constants.h" | 44 #include "chrome/installer/util/master_preferences_constants.h" |
| 44 #include "chrome/installer/util/util_constants.h" | 45 #include "chrome/installer/util/util_constants.h" |
| 45 #include "content/public/browser/notification_service.h" | 46 #include "content/public/browser/notification_service.h" |
| 46 #include "content/public/browser/notification_types.h" | 47 #include "content/public/browser/notification_types.h" |
| (...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 525 // Check the preference to determine if the bubble should be shown. | 526 // Check the preference to determine if the bubble should be shown. |
| 526 PrefService* prefs = g_browser_process->local_state(); | 527 PrefService* prefs = g_browser_process->local_state(); |
| 527 if (!prefs || !prefs->GetBoolean(prefs::kShouldShowFirstRunBubble)) { | 528 if (!prefs || !prefs->GetBoolean(prefs::kShouldShowFirstRunBubble)) { |
| 528 delete this; | 529 delete this; |
| 529 return; | 530 return; |
| 530 } | 531 } |
| 531 | 532 |
| 532 content::WebContents* contents = chrome::GetActiveWebContents(browser); | 533 content::WebContents* contents = chrome::GetActiveWebContents(browser); |
| 533 | 534 |
| 534 // Suppress the first run bubble if a Gaia sign in page is showing. | 535 // Suppress the first run bubble if a Gaia sign in page is showing. |
| 535 if (CommandLine::ForCurrentProcess()->HasSwitch( | 536 if (SyncPromoUI::UseWebBasedSigninFlow() && |
| 536 switches::kUseWebBasedSigninFlow) && | |
| 537 gaia::IsGaiaSignonRealm(contents->GetURL().GetOrigin())) { | 537 gaia::IsGaiaSignonRealm(contents->GetURL().GetOrigin())) { |
| 538 return; | 538 return; |
| 539 } | 539 } |
| 540 | 540 |
| 541 if (contents && contents->GetURL().SchemeIs(chrome::kChromeUIScheme)) { | 541 if (contents && contents->GetURL().SchemeIs(chrome::kChromeUIScheme)) { |
| 542 // Suppress the first run bubble if the sync promo is showing. | 542 // Suppress the first run bubble if the sync promo is showing. |
| 543 if (contents->GetURL().host() == chrome::kChromeUISyncPromoHost) | 543 if (contents->GetURL().host() == chrome::kChromeUISyncPromoHost) |
| 544 return; | 544 return; |
| 545 | 545 |
| 546 // Suppress the first run bubble if 'make chrome metro' flow is showing. | 546 // Suppress the first run bubble if 'make chrome metro' flow is showing. |
| (...skipping 17 matching lines...) Expand all Loading... |
| 564 | 564 |
| 565 // Reset the preference and notifications to avoid showing the bubble again. | 565 // Reset the preference and notifications to avoid showing the bubble again. |
| 566 prefs->SetBoolean(prefs::kShouldShowFirstRunBubble, false); | 566 prefs->SetBoolean(prefs::kShouldShowFirstRunBubble, false); |
| 567 | 567 |
| 568 // Show the bubble now and destroy this bubble launcher. | 568 // Show the bubble now and destroy this bubble launcher. |
| 569 browser->ShowFirstRunBubble(); | 569 browser->ShowFirstRunBubble(); |
| 570 delete this; | 570 delete this; |
| 571 } | 571 } |
| 572 | 572 |
| 573 } // namespace first_run | 573 } // namespace first_run |
| OLD | NEW |