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/ui/startup/startup_browser_creator.h" | 5 #include "chrome/browser/ui/startup/startup_browser_creator.h" |
6 | 6 |
7 #include <algorithm> // For max(). | 7 #include <algorithm> // For max(). |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "apps/app_load_service.h" | 10 #include "apps/app_load_service.h" |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 class ProfileLaunchObserver : public content::NotificationObserver { | 103 class ProfileLaunchObserver : public content::NotificationObserver { |
104 public: | 104 public: |
105 ProfileLaunchObserver() | 105 ProfileLaunchObserver() |
106 : profile_to_activate_(NULL), | 106 : profile_to_activate_(NULL), |
107 activated_profile_(false) { | 107 activated_profile_(false) { |
108 registrar_.Add(this, chrome::NOTIFICATION_PROFILE_DESTROYED, | 108 registrar_.Add(this, chrome::NOTIFICATION_PROFILE_DESTROYED, |
109 content::NotificationService::AllSources()); | 109 content::NotificationService::AllSources()); |
110 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_WINDOW_READY, | 110 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_WINDOW_READY, |
111 content::NotificationService::AllSources()); | 111 content::NotificationService::AllSources()); |
112 } | 112 } |
113 virtual ~ProfileLaunchObserver() {} | 113 ~ProfileLaunchObserver() override {} |
114 | 114 |
115 virtual void Observe(int type, | 115 void Observe(int type, |
116 const content::NotificationSource& source, | 116 const content::NotificationSource& source, |
117 const content::NotificationDetails& details) override { | 117 const content::NotificationDetails& details) override { |
118 switch (type) { | 118 switch (type) { |
119 case chrome::NOTIFICATION_PROFILE_DESTROYED: { | 119 case chrome::NOTIFICATION_PROFILE_DESTROYED: { |
120 Profile* profile = content::Source<Profile>(source).ptr(); | 120 Profile* profile = content::Source<Profile>(source).ptr(); |
121 launched_profiles_.erase(profile); | 121 launched_profiles_.erase(profile); |
122 opened_profiles_.erase(profile); | 122 opened_profiles_.erase(profile); |
123 if (profile == profile_to_activate_) | 123 if (profile == profile_to_activate_) |
124 profile_to_activate_ = NULL; | 124 profile_to_activate_ = NULL; |
125 // If this profile was the last launched one without an opened window, | 125 // If this profile was the last launched one without an opened window, |
126 // then we may be ready to activate |profile_to_activate_|. | 126 // then we may be ready to activate |profile_to_activate_|. |
127 MaybeActivateProfile(); | 127 MaybeActivateProfile(); |
(...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
746 // If we are showing the app list then chrome isn't shown so load the app | 746 // If we are showing the app list then chrome isn't shown so load the app |
747 // list's profile rather than chrome's. | 747 // list's profile rather than chrome's. |
748 if (command_line.HasSwitch(switches::kShowAppList)) { | 748 if (command_line.HasSwitch(switches::kShowAppList)) { |
749 return AppListService::Get(chrome::HOST_DESKTOP_TYPE_NATIVE)-> | 749 return AppListService::Get(chrome::HOST_DESKTOP_TYPE_NATIVE)-> |
750 GetProfilePath(user_data_dir); | 750 GetProfilePath(user_data_dir); |
751 } | 751 } |
752 | 752 |
753 return g_browser_process->profile_manager()->GetLastUsedProfileDir( | 753 return g_browser_process->profile_manager()->GetLastUsedProfileDir( |
754 user_data_dir); | 754 user_data_dir); |
755 } | 755 } |
OLD | NEW |