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_impl.h" | 5 #include "chrome/browser/ui/startup/startup_browser_creator_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "apps/app_restore_service.h" | 10 #include "apps/app_restore_service.h" |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
106 | 106 |
107 #if defined(OS_WIN) | 107 #if defined(OS_WIN) |
108 #include "base/win/windows_version.h" | 108 #include "base/win/windows_version.h" |
109 #include "chrome/browser/apps/app_launch_for_metro_restart_win.h" | 109 #include "chrome/browser/apps/app_launch_for_metro_restart_win.h" |
110 #endif | 110 #endif |
111 | 111 |
112 #if defined(ENABLE_RLZ) | 112 #if defined(ENABLE_RLZ) |
113 #include "components/rlz/rlz_tracker.h" | 113 #include "components/rlz/rlz_tracker.h" |
114 #endif | 114 #endif |
115 | 115 |
116 #if defined(OS_CHROMEOS) | |
117 #include "components/arc/arc_bridge_service.h" | |
118 #include "components/arc/arc_prefs.h" | |
119 #endif | |
120 | |
116 using content::ChildProcessSecurityPolicy; | 121 using content::ChildProcessSecurityPolicy; |
117 using content::WebContents; | 122 using content::WebContents; |
118 using extensions::Extension; | 123 using extensions::Extension; |
119 | 124 |
120 namespace { | 125 namespace { |
121 | 126 |
122 // Utility functions ---------------------------------------------------------- | 127 // Utility functions ---------------------------------------------------------- |
123 | 128 |
124 enum LaunchMode { | 129 enum LaunchMode { |
125 LM_TO_BE_DECIDED = 0, // Possibly direct launch or via a shortcut. | 130 LM_TO_BE_DECIDED = 0, // Possibly direct launch or via a shortcut. |
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
586 VLOG(1) << "Pref: default"; | 591 VLOG(1) << "Pref: default"; |
587 | 592 |
588 apps::AppRestoreService* restore_service = | 593 apps::AppRestoreService* restore_service = |
589 apps::AppRestoreServiceFactory::GetForProfile(profile_); | 594 apps::AppRestoreServiceFactory::GetForProfile(profile_); |
590 // NULL in incognito mode. | 595 // NULL in incognito mode. |
591 if (restore_service) { | 596 if (restore_service) { |
592 restore_service->HandleStartup(apps::AppRestoreService::ShouldRestoreApps( | 597 restore_service->HandleStartup(apps::AppRestoreService::ShouldRestoreApps( |
593 StartupBrowserCreator::WasRestarted())); | 598 StartupBrowserCreator::WasRestarted())); |
594 } | 599 } |
595 | 600 |
601 #if defined(OS_CHROMEOS) | |
602 // In Chrome OS let's try to restore the ARC instance if it is available. | |
603 arc::ArcBridgeService::Get()->SetEnabled( | |
sky
2015/11/10 18:47:11
Why are you doing this here rather than during bro
Luis Héctor Chávez
2015/11/10 21:03:12
Are profile preferences available there? I had tro
sky
2015/11/10 21:39:16
You may be right. But that begs another question.
Luis Héctor Chávez
2015/11/10 21:59:47
This feature will be opt-in, so we need a pref to
| |
604 arc::ArcPrefs::GetEnabled(profile_->GetPrefs())); | |
605 arc::ArcBridgeService::Get()->HandleStartup(); | |
oshima
2015/11/10 22:09:03
how about doing this in ShellObserver::OnLoginStat
Luis Héctor Chávez
2015/11/11 17:59:35
Done.
| |
606 #endif | |
607 | |
596 if (pref.type == SessionStartupPref::LAST) { | 608 if (pref.type == SessionStartupPref::LAST) { |
597 if (profile_->GetLastSessionExitType() == Profile::EXIT_CRASHED && | 609 if (profile_->GetLastSessionExitType() == Profile::EXIT_CRASHED && |
598 !command_line_.HasSwitch(switches::kRestoreLastSession)) { | 610 !command_line_.HasSwitch(switches::kRestoreLastSession)) { |
599 // The last session crashed. It's possible automatically loading the | 611 // The last session crashed. It's possible automatically loading the |
600 // page will trigger another crash, locking the user out of chrome. | 612 // page will trigger another crash, locking the user out of chrome. |
601 // To avoid this, don't restore on startup but instead show the crashed | 613 // To avoid this, don't restore on startup but instead show the crashed |
602 // infobar. | 614 // infobar. |
603 VLOG(1) << "Unclean exit; not processing"; | 615 VLOG(1) << "Unclean exit; not processing"; |
604 return false; | 616 return false; |
605 } | 617 } |
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1003 TriggeredProfileResetter* triggered_profile_resetter = | 1015 TriggeredProfileResetter* triggered_profile_resetter = |
1004 TriggeredProfileResetterFactory::GetForBrowserContext(profile_); | 1016 TriggeredProfileResetterFactory::GetForBrowserContext(profile_); |
1005 // TriggeredProfileResetter instance will be nullptr for incognito profiles. | 1017 // TriggeredProfileResetter instance will be nullptr for incognito profiles. |
1006 if (triggered_profile_resetter) { | 1018 if (triggered_profile_resetter) { |
1007 has_reset_trigger = triggered_profile_resetter->HasResetTrigger(); | 1019 has_reset_trigger = triggered_profile_resetter->HasResetTrigger(); |
1008 triggered_profile_resetter->ClearResetTrigger(); | 1020 triggered_profile_resetter->ClearResetTrigger(); |
1009 } | 1021 } |
1010 #endif // defined(OS_WIN) | 1022 #endif // defined(OS_WIN) |
1011 return has_reset_trigger; | 1023 return has_reset_trigger; |
1012 } | 1024 } |
OLD | NEW |