| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/profiles/profile_window.h" | 5 #include "chrome/browser/profiles/profile_window.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 13 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
| 14 #include "base/location.h" |
| 14 #include "base/macros.h" | 15 #include "base/macros.h" |
| 16 #include "base/single_thread_task_runner.h" |
| 15 #include "base/strings/string_number_conversions.h" | 17 #include "base/strings/string_number_conversions.h" |
| 16 #include "base/strings/utf_string_conversions.h" | 18 #include "base/strings/utf_string_conversions.h" |
| 19 #include "base/threading/thread_task_runner_handle.h" |
| 17 #include "build/build_config.h" | 20 #include "build/build_config.h" |
| 18 #include "chrome/browser/about_flags.h" | 21 #include "chrome/browser/about_flags.h" |
| 19 #include "chrome/browser/browser_process.h" | 22 #include "chrome/browser/browser_process.h" |
| 20 #include "chrome/browser/lifetime/application_lifetime.h" | 23 #include "chrome/browser/lifetime/application_lifetime.h" |
| 21 #include "chrome/browser/profiles/profile.h" | 24 #include "chrome/browser/profiles/profile.h" |
| 22 #include "chrome/browser/profiles/profile_attributes_entry.h" | 25 #include "chrome/browser/profiles/profile_attributes_entry.h" |
| 23 #include "chrome/browser/profiles/profile_attributes_storage.h" | 26 #include "chrome/browser/profiles/profile_attributes_storage.h" |
| 24 #include "chrome/browser/profiles/profile_avatar_icon_util.h" | 27 #include "chrome/browser/profiles/profile_avatar_icon_util.h" |
| 25 #include "chrome/browser/profiles/profile_manager.h" | 28 #include "chrome/browser/profiles/profile_manager.h" |
| 26 #include "chrome/browser/signin/account_reconcilor_factory.h" | 29 #include "chrome/browser/signin/account_reconcilor_factory.h" |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 ~BrowserAddedForProfileObserver() override {} | 100 ~BrowserAddedForProfileObserver() override {} |
| 98 | 101 |
| 99 private: | 102 private: |
| 100 // Overridden from BrowserListObserver: | 103 // Overridden from BrowserListObserver: |
| 101 void OnBrowserAdded(Browser* browser) override { | 104 void OnBrowserAdded(Browser* browser) override { |
| 102 if (browser->profile() == profile_) { | 105 if (browser->profile() == profile_) { |
| 103 BrowserList::RemoveObserver(this); | 106 BrowserList::RemoveObserver(this); |
| 104 // By the time the browser is added a tab (or multiple) are about to be | 107 // By the time the browser is added a tab (or multiple) are about to be |
| 105 // added. Post the callback to the message loop so it gets executed after | 108 // added. Post the callback to the message loop so it gets executed after |
| 106 // the tabs are created. | 109 // the tabs are created. |
| 107 base::MessageLoop::current()->PostTask( | 110 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 108 FROM_HERE, | 111 FROM_HERE, |
| 109 base::Bind(callback_, profile_, Profile::CREATE_STATUS_INITIALIZED)); | 112 base::Bind(callback_, profile_, Profile::CREATE_STATUS_INITIALIZED)); |
| 110 base::MessageLoop::current()->DeleteSoon(FROM_HERE, this); | 113 base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, this); |
| 111 } | 114 } |
| 112 } | 115 } |
| 113 | 116 |
| 114 // Profile for which the browser should be opened. | 117 // Profile for which the browser should be opened. |
| 115 Profile* profile_; | 118 Profile* profile_; |
| 116 ProfileManager::CreateCallback callback_; | 119 ProfileManager::CreateCallback callback_; |
| 117 | 120 |
| 118 DISALLOW_COPY_AND_ASSIGN(BrowserAddedForProfileObserver); | 121 DISALLOW_COPY_AND_ASSIGN(BrowserAddedForProfileObserver); |
| 119 }; | 122 }; |
| 120 | 123 |
| (...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 491 PrefService* local_state = g_browser_process->local_state(); | 494 PrefService* local_state = g_browser_process->local_state(); |
| 492 const bool dismissed = local_state->GetBoolean( | 495 const bool dismissed = local_state->GetBoolean( |
| 493 prefs::kProfileAvatarRightClickTutorialDismissed); | 496 prefs::kProfileAvatarRightClickTutorialDismissed); |
| 494 | 497 |
| 495 // Don't show the tutorial if it's already been dismissed or if right-clicking | 498 // Don't show the tutorial if it's already been dismissed or if right-clicking |
| 496 // wouldn't show any targets. | 499 // wouldn't show any targets. |
| 497 return !dismissed && HasProfileSwitchTargets(profile); | 500 return !dismissed && HasProfileSwitchTargets(profile); |
| 498 } | 501 } |
| 499 | 502 |
| 500 } // namespace profiles | 503 } // namespace profiles |
| OLD | NEW |