| 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 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 // This class acts as an observer for the ImporterProgressObserver::ImportEnded | 82 // This class acts as an observer for the ImporterProgressObserver::ImportEnded |
| 83 // callback. When the import process is started, certain errors may cause | 83 // callback. When the import process is started, certain errors may cause |
| 84 // ImportEnded() to be called synchronously, but the typical case is that | 84 // ImportEnded() to be called synchronously, but the typical case is that |
| 85 // ImportEnded() is called asynchronously. Thus we have to handle both cases. | 85 // ImportEnded() is called asynchronously. Thus we have to handle both cases. |
| 86 class ImportEndedObserver : public importer::ImporterProgressObserver { | 86 class ImportEndedObserver : public importer::ImporterProgressObserver { |
| 87 public: | 87 public: |
| 88 ImportEndedObserver() : ended_(false) {} | 88 ImportEndedObserver() : ended_(false) {} |
| 89 virtual ~ImportEndedObserver() {} | 89 virtual ~ImportEndedObserver() {} |
| 90 | 90 |
| 91 // importer::ImporterProgressObserver: | 91 // importer::ImporterProgressObserver: |
| 92 virtual void ImportStarted() OVERRIDE {} | 92 virtual void ImportStarted() override {} |
| 93 virtual void ImportItemStarted(importer::ImportItem item) OVERRIDE {} | 93 virtual void ImportItemStarted(importer::ImportItem item) override {} |
| 94 virtual void ImportItemEnded(importer::ImportItem item) OVERRIDE {} | 94 virtual void ImportItemEnded(importer::ImportItem item) override {} |
| 95 virtual void ImportEnded() OVERRIDE { | 95 virtual void ImportEnded() override { |
| 96 ended_ = true; | 96 ended_ = true; |
| 97 if (!callback_for_import_end_.is_null()) | 97 if (!callback_for_import_end_.is_null()) |
| 98 callback_for_import_end_.Run(); | 98 callback_for_import_end_.Run(); |
| 99 } | 99 } |
| 100 | 100 |
| 101 void set_callback_for_import_end(const base::Closure& callback) { | 101 void set_callback_for_import_end(const base::Closure& callback) { |
| 102 callback_for_import_end_ = callback; | 102 callback_for_import_end_ = callback; |
| 103 } | 103 } |
| 104 | 104 |
| 105 bool ended() const { | 105 bool ended() const { |
| (...skipping 23 matching lines...) Expand all Loading... |
| 129 registrar_.Add(this, | 129 registrar_.Add(this, |
| 130 extensions::NOTIFICATION_EXTENSIONS_READY_DEPRECATED, | 130 extensions::NOTIFICATION_EXTENSIONS_READY_DEPRECATED, |
| 131 content::NotificationService::AllSources()); | 131 content::NotificationService::AllSources()); |
| 132 } | 132 } |
| 133 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_CLOSED, | 133 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_CLOSED, |
| 134 content::NotificationService::AllSources()); | 134 content::NotificationService::AllSources()); |
| 135 } | 135 } |
| 136 | 136 |
| 137 virtual void Observe(int type, | 137 virtual void Observe(int type, |
| 138 const content::NotificationSource& source, | 138 const content::NotificationSource& source, |
| 139 const content::NotificationDetails& details) OVERRIDE { | 139 const content::NotificationDetails& details) override { |
| 140 // After processing the notification we always delete ourselves. | 140 // After processing the notification we always delete ourselves. |
| 141 if (type == extensions::NOTIFICATION_EXTENSIONS_READY_DEPRECATED) { | 141 if (type == extensions::NOTIFICATION_EXTENSIONS_READY_DEPRECATED) { |
| 142 Profile* profile = content::Source<Profile>(source).ptr(); | 142 Profile* profile = content::Source<Profile>(source).ptr(); |
| 143 ExtensionService* service = | 143 ExtensionService* service = |
| 144 extensions::ExtensionSystem::Get(profile)->extension_service(); | 144 extensions::ExtensionSystem::Get(profile)->extension_service(); |
| 145 DoExtensionWork(service); | 145 DoExtensionWork(service); |
| 146 } | 146 } |
| 147 delete this; | 147 delete this; |
| 148 } | 148 } |
| 149 | 149 |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 // instantiates a FirstRunBubbleLauncher, which manages its own lifetime. | 309 // instantiates a FirstRunBubbleLauncher, which manages its own lifetime. |
| 310 static void ShowFirstRunBubbleSoon(); | 310 static void ShowFirstRunBubbleSoon(); |
| 311 | 311 |
| 312 private: | 312 private: |
| 313 FirstRunBubbleLauncher(); | 313 FirstRunBubbleLauncher(); |
| 314 virtual ~FirstRunBubbleLauncher(); | 314 virtual ~FirstRunBubbleLauncher(); |
| 315 | 315 |
| 316 // content::NotificationObserver: | 316 // content::NotificationObserver: |
| 317 virtual void Observe(int type, | 317 virtual void Observe(int type, |
| 318 const content::NotificationSource& source, | 318 const content::NotificationSource& source, |
| 319 const content::NotificationDetails& details) OVERRIDE; | 319 const content::NotificationDetails& details) override; |
| 320 | 320 |
| 321 content::NotificationRegistrar registrar_; | 321 content::NotificationRegistrar registrar_; |
| 322 | 322 |
| 323 DISALLOW_COPY_AND_ASSIGN(FirstRunBubbleLauncher); | 323 DISALLOW_COPY_AND_ASSIGN(FirstRunBubbleLauncher); |
| 324 }; | 324 }; |
| 325 | 325 |
| 326 // static | 326 // static |
| 327 void FirstRunBubbleLauncher::ShowFirstRunBubbleSoon() { | 327 void FirstRunBubbleLauncher::ShowFirstRunBubbleSoon() { |
| 328 SetShowFirstRunBubblePref(first_run::FIRST_RUN_BUBBLE_SHOW); | 328 SetShowFirstRunBubblePref(first_run::FIRST_RUN_BUBBLE_SHOW); |
| 329 // This FirstRunBubbleLauncher instance will manage its own lifetime. | 329 // This FirstRunBubbleLauncher instance will manage its own lifetime. |
| (...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 804 SetShouldDoPersonalDataManagerFirstRun(); | 804 SetShouldDoPersonalDataManagerFirstRun(); |
| 805 | 805 |
| 806 internal::DoPostImportPlatformSpecificTasks(profile); | 806 internal::DoPostImportPlatformSpecificTasks(profile); |
| 807 } | 807 } |
| 808 | 808 |
| 809 uint16 auto_import_state() { | 809 uint16 auto_import_state() { |
| 810 return g_auto_import_state; | 810 return g_auto_import_state; |
| 811 } | 811 } |
| 812 | 812 |
| 813 } // namespace first_run | 813 } // namespace first_run |
| OLD | NEW |