| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/chromeos/arc/arc_session_manager.h" | 5 #include "chrome/browser/chromeos/arc/arc_session_manager.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "ash/common/shelf/shelf_delegate.h" | 9 #include "ash/common/shelf/shelf_delegate.h" |
| 10 #include "ash/common/wm_shell.h" | 10 #include "ash/common/wm_shell.h" |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 | 321 |
| 322 profile_->GetPrefs()->SetBoolean(prefs::kArcSignedIn, true); | 322 profile_->GetPrefs()->SetBoolean(prefs::kArcSignedIn, true); |
| 323 // Don't show Play Store app for ARC Kiosk because the only one UI in kiosk | 323 // Don't show Play Store app for ARC Kiosk because the only one UI in kiosk |
| 324 // mode must be the kiosk app and device is not needed for opt-in. | 324 // mode must be the kiosk app and device is not needed for opt-in. |
| 325 if (!IsOptInVerificationDisabled() && !IsArcKioskMode()) { | 325 if (!IsOptInVerificationDisabled() && !IsArcKioskMode()) { |
| 326 playstore_launcher_.reset( | 326 playstore_launcher_.reset( |
| 327 new ArcAppLauncher(profile_, kPlayStoreAppId, true)); | 327 new ArcAppLauncher(profile_, kPlayStoreAppId, true)); |
| 328 } | 328 } |
| 329 | 329 |
| 330 for (auto& observer : observer_list_) | 330 for (auto& observer : observer_list_) |
| 331 observer.OnInitialStart(); | 331 observer.OnArcInitialStart(); |
| 332 return; | 332 return; |
| 333 } | 333 } |
| 334 | 334 |
| 335 ArcSupportHost::Error error; | 335 ArcSupportHost::Error error; |
| 336 switch (result) { | 336 switch (result) { |
| 337 case ProvisioningResult::GMS_NETWORK_ERROR: | 337 case ProvisioningResult::GMS_NETWORK_ERROR: |
| 338 error = ArcSupportHost::Error::SIGN_IN_NETWORK_ERROR; | 338 error = ArcSupportHost::Error::SIGN_IN_NETWORK_ERROR; |
| 339 break; | 339 break; |
| 340 case ProvisioningResult::GMS_SERVICE_UNAVAILABLE: | 340 case ProvisioningResult::GMS_SERVICE_UNAVAILABLE: |
| 341 case ProvisioningResult::GMS_SIGN_IN_FAILED: | 341 case ProvisioningResult::GMS_SIGN_IN_FAILED: |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 529 | 529 |
| 530 void ArcSessionManager::OnOptInPreferenceChanged() { | 530 void ArcSessionManager::OnOptInPreferenceChanged() { |
| 531 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 531 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 532 DCHECK(profile_); | 532 DCHECK(profile_); |
| 533 | 533 |
| 534 // TODO(dspaid): Move code from OnSyncedPrefChanged into this method. | 534 // TODO(dspaid): Move code from OnSyncedPrefChanged into this method. |
| 535 OnSyncedPrefChanged(prefs::kArcEnabled, IsArcManaged()); | 535 OnSyncedPrefChanged(prefs::kArcEnabled, IsArcManaged()); |
| 536 | 536 |
| 537 const bool arc_enabled = IsArcEnabled(); | 537 const bool arc_enabled = IsArcEnabled(); |
| 538 for (auto& observer : observer_list_) | 538 for (auto& observer : observer_list_) |
| 539 observer.OnOptInEnabled(arc_enabled); | 539 observer.OnArcOptInChanged(arc_enabled); |
| 540 | 540 |
| 541 if (!arc_enabled) { | 541 if (!arc_enabled) { |
| 542 // Reset any pending request to re-enable Arc. | 542 // Reset any pending request to re-enable Arc. |
| 543 reenable_arc_ = false; | 543 reenable_arc_ = false; |
| 544 StopArc(); | 544 StopArc(); |
| 545 RemoveArcData(); | 545 RemoveArcData(); |
| 546 return; | 546 return; |
| 547 } | 547 } |
| 548 | 548 |
| 549 if (state_ == State::ACTIVE) | 549 if (state_ == State::ACTIVE) |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 616 | 616 |
| 617 void ArcSessionManager::ShutdownBridge() { | 617 void ArcSessionManager::ShutdownBridge() { |
| 618 arc_sign_in_timer_.Stop(); | 618 arc_sign_in_timer_.Stop(); |
| 619 playstore_launcher_.reset(); | 619 playstore_launcher_.reset(); |
| 620 terms_of_service_negotiator_.reset(); | 620 terms_of_service_negotiator_.reset(); |
| 621 android_management_checker_.reset(); | 621 android_management_checker_.reset(); |
| 622 arc_bridge_service()->RequestStop(); | 622 arc_bridge_service()->RequestStop(); |
| 623 if (state_ != State::NOT_INITIALIZED && state_ != State::REMOVING_DATA_DIR) | 623 if (state_ != State::NOT_INITIALIZED && state_ != State::REMOVING_DATA_DIR) |
| 624 SetState(State::STOPPED); | 624 SetState(State::STOPPED); |
| 625 for (auto& observer : observer_list_) | 625 for (auto& observer : observer_list_) |
| 626 observer.OnShutdownBridge(); | 626 observer.OnArcBridgeShutdown(); |
| 627 } | 627 } |
| 628 | 628 |
| 629 void ArcSessionManager::AddObserver(Observer* observer) { | 629 void ArcSessionManager::AddObserver(Observer* observer) { |
| 630 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 630 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 631 observer_list_.AddObserver(observer); | 631 observer_list_.AddObserver(observer); |
| 632 } | 632 } |
| 633 | 633 |
| 634 void ArcSessionManager::RemoveObserver(Observer* observer) { | 634 void ArcSessionManager::RemoveObserver(Observer* observer) { |
| 635 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 635 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 636 observer_list_.RemoveObserver(observer); | 636 observer_list_.RemoveObserver(observer); |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 923 return os << "ACTIVE"; | 923 return os << "ACTIVE"; |
| 924 } | 924 } |
| 925 | 925 |
| 926 // Some compiler reports an error even if all values of an enum-class are | 926 // Some compiler reports an error even if all values of an enum-class are |
| 927 // covered indivisually in a switch statement. | 927 // covered indivisually in a switch statement. |
| 928 NOTREACHED(); | 928 NOTREACHED(); |
| 929 return os; | 929 return os; |
| 930 } | 930 } |
| 931 | 931 |
| 932 } // namespace arc | 932 } // namespace arc |
| OLD | NEW |