| 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 #import "chrome/browser/app_controller_mac.h" | 5 #import "chrome/browser/app_controller_mac.h" |
| 6 | 6 |
| 7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 public: | 229 public: |
| 230 AppControllerProfileObserver( | 230 AppControllerProfileObserver( |
| 231 ProfileManager* profile_manager, AppController* app_controller) | 231 ProfileManager* profile_manager, AppController* app_controller) |
| 232 : profile_manager_(profile_manager), | 232 : profile_manager_(profile_manager), |
| 233 app_controller_(app_controller) { | 233 app_controller_(app_controller) { |
| 234 DCHECK(profile_manager_); | 234 DCHECK(profile_manager_); |
| 235 DCHECK(app_controller_); | 235 DCHECK(app_controller_); |
| 236 profile_manager_->GetProfileInfoCache().AddObserver(this); | 236 profile_manager_->GetProfileInfoCache().AddObserver(this); |
| 237 } | 237 } |
| 238 | 238 |
| 239 virtual ~AppControllerProfileObserver() { | 239 ~AppControllerProfileObserver() override { |
| 240 DCHECK(profile_manager_); | 240 DCHECK(profile_manager_); |
| 241 profile_manager_->GetProfileInfoCache().RemoveObserver(this); | 241 profile_manager_->GetProfileInfoCache().RemoveObserver(this); |
| 242 } | 242 } |
| 243 | 243 |
| 244 private: | 244 private: |
| 245 // ProfileInfoCacheObserver implementation: | 245 // ProfileInfoCacheObserver implementation: |
| 246 | 246 |
| 247 virtual void OnProfileAdded(const base::FilePath& profile_path) override { | 247 void OnProfileAdded(const base::FilePath& profile_path) override {} |
| 248 } | |
| 249 | 248 |
| 250 virtual void OnProfileWasRemoved( | 249 void OnProfileWasRemoved(const base::FilePath& profile_path, |
| 251 const base::FilePath& profile_path, | 250 const base::string16& profile_name) override { |
| 252 const base::string16& profile_name) override { | |
| 253 // When a profile is deleted we need to notify the AppController, | 251 // When a profile is deleted we need to notify the AppController, |
| 254 // so it can correctly update its pointer to the last used profile. | 252 // so it can correctly update its pointer to the last used profile. |
| 255 [app_controller_ profileWasRemoved:profile_path]; | 253 [app_controller_ profileWasRemoved:profile_path]; |
| 256 } | 254 } |
| 257 | 255 |
| 258 virtual void OnProfileWillBeRemoved( | 256 void OnProfileWillBeRemoved(const base::FilePath& profile_path) override {} |
| 259 const base::FilePath& profile_path) override { | |
| 260 } | |
| 261 | 257 |
| 262 virtual void OnProfileNameChanged( | 258 void OnProfileNameChanged(const base::FilePath& profile_path, |
| 263 const base::FilePath& profile_path, | 259 const base::string16& old_profile_name) override {} |
| 264 const base::string16& old_profile_name) override { | |
| 265 } | |
| 266 | 260 |
| 267 virtual void OnProfileAvatarChanged( | 261 void OnProfileAvatarChanged(const base::FilePath& profile_path) override {} |
| 268 const base::FilePath& profile_path) override { | |
| 269 } | |
| 270 | 262 |
| 271 ProfileManager* profile_manager_; | 263 ProfileManager* profile_manager_; |
| 272 | 264 |
| 273 AppController* app_controller_; // Weak; owns us. | 265 AppController* app_controller_; // Weak; owns us. |
| 274 | 266 |
| 275 DISALLOW_COPY_AND_ASSIGN(AppControllerProfileObserver); | 267 DISALLOW_COPY_AND_ASSIGN(AppControllerProfileObserver); |
| 276 }; | 268 }; |
| 277 | 269 |
| 278 @implementation AppController | 270 @implementation AppController |
| 279 | 271 |
| (...skipping 1300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1580 | 1572 |
| 1581 //--------------------------------------------------------------------------- | 1573 //--------------------------------------------------------------------------- |
| 1582 | 1574 |
| 1583 namespace app_controller_mac { | 1575 namespace app_controller_mac { |
| 1584 | 1576 |
| 1585 bool IsOpeningNewWindow() { | 1577 bool IsOpeningNewWindow() { |
| 1586 return g_is_opening_new_window; | 1578 return g_is_opening_new_window; |
| 1587 } | 1579 } |
| 1588 | 1580 |
| 1589 } // namespace app_controller_mac | 1581 } // namespace app_controller_mac |
| OLD | NEW |