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 10 matching lines...) Expand all Loading... |
21 #include "chrome/browser/importer/importer_list.h" | 21 #include "chrome/browser/importer/importer_list.h" |
22 #include "chrome/browser/importer/importer_progress_dialog.h" | 22 #include "chrome/browser/importer/importer_progress_dialog.h" |
23 #include "chrome/browser/importer/importer_progress_observer.h" | 23 #include "chrome/browser/importer/importer_progress_observer.h" |
24 #include "chrome/browser/prefs/pref_service.h" | 24 #include "chrome/browser/prefs/pref_service.h" |
25 #include "chrome/browser/process_singleton.h" | 25 #include "chrome/browser/process_singleton.h" |
26 #include "chrome/browser/profiles/profile_manager.h" | 26 #include "chrome/browser/profiles/profile_manager.h" |
27 #include "chrome/browser/search_engines/template_url_service.h" | 27 #include "chrome/browser/search_engines/template_url_service.h" |
28 #include "chrome/browser/search_engines/template_url_service_factory.h" | 28 #include "chrome/browser/search_engines/template_url_service_factory.h" |
29 #include "chrome/browser/shell_integration.h" | 29 #include "chrome/browser/shell_integration.h" |
30 #include "chrome/browser/ui/browser.h" | 30 #include "chrome/browser/ui/browser.h" |
| 31 #include "chrome/browser/ui/browser_finder.h" |
31 #include "chrome/browser/ui/global_error_service.h" | 32 #include "chrome/browser/ui/global_error_service.h" |
32 #include "chrome/browser/ui/global_error_service_factory.h" | 33 #include "chrome/browser/ui/global_error_service_factory.h" |
33 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" | 34 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" |
34 #include "chrome/common/chrome_paths.h" | 35 #include "chrome/common/chrome_paths.h" |
35 #include "chrome/common/chrome_switches.h" | 36 #include "chrome/common/chrome_switches.h" |
36 #include "chrome/common/pref_names.h" | 37 #include "chrome/common/pref_names.h" |
37 #include "chrome/common/url_constants.h" | 38 #include "chrome/common/url_constants.h" |
38 #include "chrome/installer/util/master_preferences.h" | 39 #include "chrome/installer/util/master_preferences.h" |
39 #include "chrome/installer/util/master_preferences_constants.h" | 40 #include "chrome/installer/util/master_preferences_constants.h" |
40 #include "chrome/installer/util/util_constants.h" | 41 #include "chrome/installer/util/util_constants.h" |
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
490 content::NotificationService::AllSources()); | 491 content::NotificationService::AllSources()); |
491 } | 492 } |
492 | 493 |
493 FirstRunBubbleLauncher::~FirstRunBubbleLauncher() {} | 494 FirstRunBubbleLauncher::~FirstRunBubbleLauncher() {} |
494 | 495 |
495 void FirstRunBubbleLauncher::Observe( | 496 void FirstRunBubbleLauncher::Observe( |
496 int type, | 497 int type, |
497 const content::NotificationSource& source, | 498 const content::NotificationSource& source, |
498 const content::NotificationDetails& details) { | 499 const content::NotificationDetails& details) { |
499 DCHECK_EQ(type, content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME); | 500 DCHECK_EQ(type, content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME); |
500 Browser* browser = BrowserList::FindBrowserWithWebContents( | 501 Browser* browser = browser::FindBrowserWithWebContents( |
501 content::Source<content::WebContents>(source).ptr()); | 502 content::Source<content::WebContents>(source).ptr()); |
502 if (!browser || !browser->is_type_tabbed()) | 503 if (!browser || !browser->is_type_tabbed()) |
503 return; | 504 return; |
504 | 505 |
505 // Check the preference to determine if the bubble should be shown. | 506 // Check the preference to determine if the bubble should be shown. |
506 PrefService* prefs = g_browser_process->local_state(); | 507 PrefService* prefs = g_browser_process->local_state(); |
507 if (!prefs || !prefs->GetBoolean(prefs::kShouldShowFirstRunBubble)) { | 508 if (!prefs || !prefs->GetBoolean(prefs::kShouldShowFirstRunBubble)) { |
508 delete this; | 509 delete this; |
509 return; | 510 return; |
510 } | 511 } |
(...skipping 21 matching lines...) Expand all Loading... |
532 | 533 |
533 // Reset the preference and notifications to avoid showing the bubble again. | 534 // Reset the preference and notifications to avoid showing the bubble again. |
534 prefs->SetBoolean(prefs::kShouldShowFirstRunBubble, false); | 535 prefs->SetBoolean(prefs::kShouldShowFirstRunBubble, false); |
535 | 536 |
536 // Show the bubble now and destroy this bubble launcher. | 537 // Show the bubble now and destroy this bubble launcher. |
537 browser->ShowFirstRunBubble(); | 538 browser->ShowFirstRunBubble(); |
538 delete this; | 539 delete this; |
539 } | 540 } |
540 | 541 |
541 } // namespace first_run | 542 } // namespace first_run |
OLD | NEW |