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 <algorithm> | 7 #include <algorithm> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 const std::vector<std::string>& src, | 323 const std::vector<std::string>& src, |
324 std::vector<GURL>* ret) { | 324 std::vector<GURL>* ret) { |
325 ret->resize(src.size()); | 325 ret->resize(src.size()); |
326 std::transform(src.begin(), src.end(), ret->begin(), &UrlFromString); | 326 std::transform(src.begin(), src.end(), ret->begin(), &UrlFromString); |
327 } | 327 } |
328 | 328 |
329 bool IsOnWelcomePage(content::WebContents* contents) { | 329 bool IsOnWelcomePage(content::WebContents* contents) { |
330 // We have to check both the GetURL() similar to the other checks below, but | 330 // We have to check both the GetURL() similar to the other checks below, but |
331 // also the original request url because the welcome page we use is a | 331 // also the original request url because the welcome page we use is a |
332 // redirect. | 332 // redirect. |
333 GURL welcome_page(l10n_util::GetStringUTF8(IDS_WELCOME_PAGE_URL)); | 333 // TODO(crbug.com/651465): Remove this once kUseConsolidatedStartupFlow is on |
334 return contents->GetURL() == welcome_page || | 334 // by default. |
335 (contents->GetController().GetVisibleEntry() && | 335 const GURL deprecated_welcome_page( |
336 contents->GetController() | 336 l10n_util::GetStringUTF8(IDS_WELCOME_PAGE_URL)); |
337 .GetVisibleEntry() | 337 if (contents->GetURL() == deprecated_welcome_page || |
338 ->GetOriginalRequestURL() == welcome_page); | 338 (contents->GetController().GetVisibleEntry() && |
| 339 contents->GetController().GetVisibleEntry()->GetOriginalRequestURL() == |
| 340 deprecated_welcome_page)) { |
| 341 return true; |
| 342 } |
| 343 |
| 344 const GURL welcome_page(chrome::kChromeUIWelcomeURL); |
| 345 return contents->GetURL().GetWithEmptyPath() == welcome_page; |
339 } | 346 } |
340 | 347 |
341 // Show the first run search engine bubble at the first appropriate opportunity. | 348 // Show the first run search engine bubble at the first appropriate opportunity. |
342 // This bubble may be delayed by other UI, like global errors and sync promos. | 349 // This bubble may be delayed by other UI, like global errors and sync promos. |
343 class FirstRunBubbleLauncher : public content::NotificationObserver { | 350 class FirstRunBubbleLauncher : public content::NotificationObserver { |
344 public: | 351 public: |
345 // Show the bubble at the first appropriate opportunity. This function | 352 // Show the bubble at the first appropriate opportunity. This function |
346 // instantiates a FirstRunBubbleLauncher, which manages its own lifetime. | 353 // instantiates a FirstRunBubbleLauncher, which manages its own lifetime. |
347 static void ShowFirstRunBubbleSoon(); | 354 static void ShowFirstRunBubbleSoon(); |
348 | 355 |
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
850 SetShouldDoPersonalDataManagerFirstRun(); | 857 SetShouldDoPersonalDataManagerFirstRun(); |
851 | 858 |
852 internal::DoPostImportPlatformSpecificTasks(profile); | 859 internal::DoPostImportPlatformSpecificTasks(profile); |
853 } | 860 } |
854 | 861 |
855 uint16_t auto_import_state() { | 862 uint16_t auto_import_state() { |
856 return g_auto_import_state; | 863 return g_auto_import_state; |
857 } | 864 } |
858 | 865 |
859 } // namespace first_run | 866 } // namespace first_run |
OLD | NEW |