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/ui/ash/launcher/chrome_launcher_controller.h" | 5 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "ash/ash_switches.h" | 9 #include "ash/ash_switches.h" |
10 #include "ash/desktop_background/desktop_background_controller.h" | 10 #include "ash/desktop_background/desktop_background_controller.h" |
(...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
686 } | 686 } |
687 | 687 |
688 #if defined(OS_WIN) | 688 #if defined(OS_WIN) |
689 if (LaunchedInNativeDesktop(app_id)) | 689 if (LaunchedInNativeDesktop(app_id)) |
690 return; | 690 return; |
691 #endif | 691 #endif |
692 | 692 |
693 // The app will be created for the currently active profile. | 693 // The app will be created for the currently active profile. |
694 AppLaunchParams params( | 694 AppLaunchParams params( |
695 profile_, extension, ui::DispositionFromEventFlags(event_flags), | 695 profile_, extension, ui::DispositionFromEventFlags(event_flags), |
696 chrome::HOST_DESKTOP_TYPE_ASH, extensions::SOURCE_APP_LAUNCHER); | 696 ui::HOST_DESKTOP_TYPE_ASH, extensions::SOURCE_APP_LAUNCHER); |
697 if (source != ash::LAUNCH_FROM_UNKNOWN && | 697 if (source != ash::LAUNCH_FROM_UNKNOWN && |
698 app_id == extensions::kWebStoreAppId) { | 698 app_id == extensions::kWebStoreAppId) { |
699 // Get the corresponding source string. | 699 // Get the corresponding source string. |
700 std::string source_value = GetSourceFromAppListSource(source); | 700 std::string source_value = GetSourceFromAppListSource(source); |
701 | 701 |
702 // Set an override URL to include the source. | 702 // Set an override URL to include the source. |
703 GURL extension_url = extensions::AppLaunchInfo::GetFullLaunchURL(extension); | 703 GURL extension_url = extensions::AppLaunchInfo::GetFullLaunchURL(extension); |
704 params.override_url = net::AppendQueryParameter( | 704 params.override_url = net::AppendQueryParameter( |
705 extension_url, extension_urls::kWebstoreSourceField, source_value); | 705 extension_url, extension_urls::kWebstoreSourceField, source_value); |
706 } | 706 } |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
865 LOG(ERROR) << "Unexpected change of shelf item id: " << id; | 865 LOG(ERROR) << "Unexpected change of shelf item id: " << id; |
866 id_to_item_controller_map_.erase(iter); | 866 id_to_item_controller_map_.erase(iter); |
867 } | 867 } |
868 | 868 |
869 bool ChromeLauncherController::IsLoggedInAsGuest() { | 869 bool ChromeLauncherController::IsLoggedInAsGuest() { |
870 return profile_->IsGuestSession(); | 870 return profile_->IsGuestSession(); |
871 } | 871 } |
872 | 872 |
873 void ChromeLauncherController::CreateNewWindow() { | 873 void ChromeLauncherController::CreateNewWindow() { |
874 // Use the currently active user. | 874 // Use the currently active user. |
875 chrome::NewEmptyWindow(profile_, chrome::HOST_DESKTOP_TYPE_ASH); | 875 chrome::NewEmptyWindow(profile_, ui::HOST_DESKTOP_TYPE_ASH); |
876 } | 876 } |
877 | 877 |
878 void ChromeLauncherController::CreateNewIncognitoWindow() { | 878 void ChromeLauncherController::CreateNewIncognitoWindow() { |
879 // Use the currently active user. | 879 // Use the currently active user. |
880 chrome::NewEmptyWindow(profile_->GetOffTheRecordProfile(), | 880 chrome::NewEmptyWindow(profile_->GetOffTheRecordProfile(), |
881 chrome::HOST_DESKTOP_TYPE_ASH); | 881 ui::HOST_DESKTOP_TYPE_ASH); |
882 } | 882 } |
883 | 883 |
884 void ChromeLauncherController::PersistPinnedState() { | 884 void ChromeLauncherController::PersistPinnedState() { |
885 if (ignore_persist_pinned_state_change_) | 885 if (ignore_persist_pinned_state_change_) |
886 return; | 886 return; |
887 // It is a coding error to call PersistPinnedState() if the pinned apps are | 887 // It is a coding error to call PersistPinnedState() if the pinned apps are |
888 // not user-editable. The code should check earlier and not perform any | 888 // not user-editable. The code should check earlier and not perform any |
889 // modification actions that trigger persisting the state. | 889 // modification actions that trigger persisting the state. |
890 if (!CanPin()) { | 890 if (!CanPin()) { |
891 NOTREACHED() << "Can't pin but pinned state being updated"; | 891 NOTREACHED() << "Can't pin but pinned state being updated"; |
(...skipping 1122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2014 return profile->IsOffTheRecord() && !profile->IsGuestSession() && | 2014 return profile->IsOffTheRecord() && !profile->IsGuestSession() && |
2015 !profile->IsSystemProfile(); | 2015 !profile->IsSystemProfile(); |
2016 } | 2016 } |
2017 | 2017 |
2018 void ChromeLauncherController::CloseWindowedAppsFromRemovedExtension( | 2018 void ChromeLauncherController::CloseWindowedAppsFromRemovedExtension( |
2019 const std::string& app_id, | 2019 const std::string& app_id, |
2020 const Profile* profile) { | 2020 const Profile* profile) { |
2021 // This function cannot rely on the controller's enumeration functionality | 2021 // This function cannot rely on the controller's enumeration functionality |
2022 // since the extension has already be unloaded. | 2022 // since the extension has already be unloaded. |
2023 const BrowserList* ash_browser_list = | 2023 const BrowserList* ash_browser_list = |
2024 BrowserList::GetInstance(chrome::HOST_DESKTOP_TYPE_ASH); | 2024 BrowserList::GetInstance(ui::HOST_DESKTOP_TYPE_ASH); |
2025 std::vector<Browser*> browser_to_close; | 2025 std::vector<Browser*> browser_to_close; |
2026 for (BrowserList::const_reverse_iterator | 2026 for (BrowserList::const_reverse_iterator |
2027 it = ash_browser_list->begin_last_active(); | 2027 it = ash_browser_list->begin_last_active(); |
2028 it != ash_browser_list->end_last_active(); ++it) { | 2028 it != ash_browser_list->end_last_active(); ++it) { |
2029 Browser* browser = *it; | 2029 Browser* browser = *it; |
2030 if (!browser->is_type_tabbed() && browser->is_type_popup() && | 2030 if (!browser->is_type_tabbed() && browser->is_type_popup() && |
2031 browser->is_app() && | 2031 browser->is_app() && |
2032 app_id == | 2032 app_id == |
2033 web_app::GetExtensionIdFromApplicationName(browser->app_name()) && | 2033 web_app::GetExtensionIdFromApplicationName(browser->app_name()) && |
2034 profile == browser->profile()) { | 2034 profile == browser->profile()) { |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2099 void ChromeLauncherController::ReleaseProfile() { | 2099 void ChromeLauncherController::ReleaseProfile() { |
2100 if (app_sync_ui_state_) | 2100 if (app_sync_ui_state_) |
2101 app_sync_ui_state_->RemoveObserver(this); | 2101 app_sync_ui_state_->RemoveObserver(this); |
2102 | 2102 |
2103 extensions::ExtensionRegistry::Get(profile_)->RemoveObserver(this); | 2103 extensions::ExtensionRegistry::Get(profile_)->RemoveObserver(this); |
2104 | 2104 |
2105 PrefServiceSyncable::FromProfile(profile_)->RemoveObserver(this); | 2105 PrefServiceSyncable::FromProfile(profile_)->RemoveObserver(this); |
2106 | 2106 |
2107 pref_change_registrar_.RemoveAll(); | 2107 pref_change_registrar_.RemoveAll(); |
2108 } | 2108 } |
OLD | NEW |