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/ash/launcher/chrome_launcher_controller_per_app.h" | 5 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_app.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "ash/launcher/launcher_model.h" | 9 #include "ash/launcher/launcher_model.h" |
10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
11 #include "ash/wm/window_util.h" | 11 #include "ash/wm/window_util.h" |
12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
13 #include "base/string_number_conversions.h" | |
13 #include "base/values.h" | 14 #include "base/values.h" |
14 #include "chrome/browser/defaults.h" | 15 #include "chrome/browser/defaults.h" |
15 #include "chrome/browser/extensions/extension_service.h" | 16 #include "chrome/browser/extensions/extension_service.h" |
16 #include "chrome/browser/prefs/incognito_mode_prefs.h" | 17 #include "chrome/browser/prefs/incognito_mode_prefs.h" |
17 #include "chrome/browser/prefs/pref_service.h" | 18 #include "chrome/browser/prefs/pref_service.h" |
18 #include "chrome/browser/prefs/scoped_user_pref_update.h" | 19 #include "chrome/browser/prefs/scoped_user_pref_update.h" |
19 #include "chrome/browser/profiles/profile.h" | 20 #include "chrome/browser/profiles/profile.h" |
20 #include "chrome/browser/profiles/profile_manager.h" | 21 #include "chrome/browser/profiles/profile_manager.h" |
21 #include "chrome/browser/ui/ash/app_sync_ui_state.h" | 22 #include "chrome/browser/ui/ash/app_sync_ui_state.h" |
22 #include "chrome/browser/ui/ash/chrome_launcher_prefs.h" | 23 #include "chrome/browser/ui/ash/chrome_launcher_prefs.h" |
(...skipping 14 matching lines...) Expand all Loading... | |
37 #include "chrome/common/chrome_switches.h" | 38 #include "chrome/common/chrome_switches.h" |
38 #include "chrome/common/extensions/extension.h" | 39 #include "chrome/common/extensions/extension.h" |
39 #include "chrome/common/extensions/extension_resource.h" | 40 #include "chrome/common/extensions/extension_resource.h" |
40 #include "chrome/common/pref_names.h" | 41 #include "chrome/common/pref_names.h" |
41 #include "chrome/common/url_constants.h" | 42 #include "chrome/common/url_constants.h" |
42 #include "content/public/browser/navigation_entry.h" | 43 #include "content/public/browser/navigation_entry.h" |
43 #include "content/public/browser/notification_service.h" | 44 #include "content/public/browser/notification_service.h" |
44 #include "content/public/browser/web_contents.h" | 45 #include "content/public/browser/web_contents.h" |
45 #include "extensions/common/url_pattern.h" | 46 #include "extensions/common/url_pattern.h" |
46 #include "grit/theme_resources.h" | 47 #include "grit/theme_resources.h" |
48 #include "ui/aura/root_window.h" | |
47 #include "ui/aura/window.h" | 49 #include "ui/aura/window.h" |
48 | 50 |
49 using content::WebContents; | 51 using content::WebContents; |
50 using extensions::Extension; | 52 using extensions::Extension; |
51 | 53 |
52 namespace { | 54 namespace { |
53 | 55 |
54 // Item controller for an app shortcut. Shortcuts track app and launcher ids, | 56 // Item controller for an app shortcut. Shortcuts track app and launcher ids, |
55 // but do not have any associated windows (opening a shortcut will replace the | 57 // but do not have any associated windows (opening a shortcut will replace the |
56 // item with the appropriate LauncherItemController type). | 58 // item with the appropriate LauncherItemController type). |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
111 | 113 |
112 // Stores the optional refocus url pattern for this item. | 114 // Stores the optional refocus url pattern for this item. |
113 const GURL& refocus_url() const { return refocus_url_; } | 115 const GURL& refocus_url() const { return refocus_url_; } |
114 void set_refocus_url(const GURL& refocus_url) { refocus_url_ = refocus_url; } | 116 void set_refocus_url(const GURL& refocus_url) { refocus_url_ = refocus_url; } |
115 | 117 |
116 private: | 118 private: |
117 GURL refocus_url_; | 119 GURL refocus_url_; |
118 DISALLOW_COPY_AND_ASSIGN(AppShortcutLauncherItemController); | 120 DISALLOW_COPY_AND_ASSIGN(AppShortcutLauncherItemController); |
119 }; | 121 }; |
120 | 122 |
121 // If the value of the pref at |local_path is not empty, it is returned | 123 std::string GetPrefKeyForRootWindow(aura::RootWindow* root_window) { |
122 // otherwise the value of the pref at |synced_path| is returned. | 124 gfx::Display display = gfx::Screen::GetScreenFor( |
123 std::string GetLocalOrRemotePref(PrefService* pref_service, | 125 root_window)->GetDisplayNearestWindow(root_window); |
126 DCHECK(display.is_valid()); | |
127 | |
128 return base::Int64ToString(display.id()); | |
129 } | |
130 | |
131 void UpdatePerDisplayPref(PrefService* pref_service, | |
132 aura::RootWindow* root_window, | |
133 const char* pref_key, | |
134 const std::string& value) { | |
135 std::string key = GetPrefKeyForRootWindow(root_window); | |
136 if (key.empty()) | |
137 return; | |
138 | |
139 DictionaryPrefUpdate update(pref_service, prefs::kShelfPreferences); | |
140 base::DictionaryValue* shelf_prefs = update.Get(); | |
141 base::DictionaryValue* prefs = NULL; | |
142 if (!shelf_prefs->GetDictionary(key, &prefs)) { | |
143 prefs = new base::DictionaryValue(); | |
144 shelf_prefs->Set(key, prefs); | |
145 } | |
146 prefs->SetStringWithoutPathExpansion(pref_key, value); | |
147 } | |
148 | |
149 // Returns a pref value in |pref_service| for the display of |root_window|. The | |
150 // pref value is stored in |local_path| and |path|, but |pref_service| may have | |
151 // per-display preferences and the value can be specified by policy. Here is | |
152 // the priority: | |
153 // * A value managed by policy. This is a single value that applies to all | |
154 // displays. | |
155 // * A user-set value for the specified display. | |
156 // * A user-set value in |local_path| or |path|. |local_path| is preferred. See | |
157 // comment in |kShelfAlignment| as to why we consider two prefs and why | |
158 // |local_path| is preferred. | |
159 // * A value recommended by policy. This is a single value that applies to all | |
160 // root windows. | |
161 std::string GetPrefForRootWindow(PrefService* pref_service, | |
162 aura::RootWindow* root_window, | |
124 const char* local_path, | 163 const char* local_path, |
125 const char* synced_path) { | 164 const char* path) { |
165 const PrefService::Preference* local_pref = | |
166 pref_service->FindPreference(local_path); | |
126 const std::string value(pref_service->GetString(local_path)); | 167 const std::string value(pref_service->GetString(local_path)); |
127 return value.empty() ? pref_service->GetString(synced_path) : value; | 168 if (local_pref->IsManaged()) |
169 return value; | |
170 | |
171 std::string pref_key = GetPrefKeyForRootWindow(root_window); | |
172 if (!pref_key.empty()) { | |
173 const base::DictionaryValue* shelf_prefs = pref_service->GetDictionary( | |
174 prefs::kShelfPreferences); | |
175 const base::DictionaryValue* display_pref = NULL; | |
176 std::string per_display_value; | |
177 if (shelf_prefs->GetDictionary(pref_key, &display_pref) && | |
178 display_pref->GetString(path, &per_display_value)) { | |
179 return per_display_value; | |
180 } | |
181 } | |
182 | |
183 if (!local_pref->HasUserSetting() && | |
bartfab (slow)
2012/12/14 23:07:18
This condition will actually never be true. |pref|
Jun Mukai
2012/12/14 23:40:56
Agreed. Done.
| |
184 pref_service->FindPreference(path)->HasUserSetting()) { | |
185 return pref_service->GetString(path); | |
186 } | |
187 | |
188 if (local_pref->IsRecommended()) | |
189 return value; | |
190 | |
191 return value.empty() ? pref_service->GetString(path) : value; | |
128 } | 192 } |
129 | 193 |
130 // If prefs have synced and no user-set value exists at |local_path|, the value | 194 // If prefs have synced and no user-set value exists at |local_path|, the value |
131 // from |synced_path| is copied to |local_path|. | 195 // from |synced_path| is copied to |local_path|. |
132 void MaybePropagatePrefToLocal(PrefService* pref_service, | 196 void MaybePropagatePrefToLocal(PrefService* pref_service, |
133 const char* local_path, | 197 const char* local_path, |
134 const char* synced_path) { | 198 const char* synced_path) { |
135 if (!pref_service->FindPreference(local_path)->HasUserSetting() && | 199 if (!pref_service->FindPreference(local_path)->HasUserSetting() && |
136 pref_service->IsSyncing()) { | 200 pref_service->IsSyncing()) { |
137 // First time the user is using this machine, propagate from remote to | 201 // First time the user is using this machine, propagate from remote to |
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
556 | 620 |
557 bool ChromeLauncherControllerPerApp::CanPin() const { | 621 bool ChromeLauncherControllerPerApp::CanPin() const { |
558 const PrefService::Preference* pref = | 622 const PrefService::Preference* pref = |
559 profile_->GetPrefs()->FindPreference(prefs::kPinnedLauncherApps); | 623 profile_->GetPrefs()->FindPreference(prefs::kPinnedLauncherApps); |
560 return pref && pref->IsUserModifiable(); | 624 return pref && pref->IsUserModifiable(); |
561 } | 625 } |
562 | 626 |
563 ash::ShelfAutoHideBehavior | 627 ash::ShelfAutoHideBehavior |
564 ChromeLauncherControllerPerApp::GetShelfAutoHideBehavior( | 628 ChromeLauncherControllerPerApp::GetShelfAutoHideBehavior( |
565 aura::RootWindow* root_window) const { | 629 aura::RootWindow* root_window) const { |
566 // TODO(oshima): Support multiple launchers. | |
567 | |
568 // See comment in |kShelfAlignment| as to why we consider two prefs. | 630 // See comment in |kShelfAlignment| as to why we consider two prefs. |
569 const std::string behavior_value( | 631 const std::string behavior_value( |
570 GetLocalOrRemotePref(profile_->GetPrefs(), | 632 GetPrefForRootWindow(profile_->GetPrefs(), |
633 root_window, | |
571 prefs::kShelfAutoHideBehaviorLocal, | 634 prefs::kShelfAutoHideBehaviorLocal, |
572 prefs::kShelfAutoHideBehavior)); | 635 prefs::kShelfAutoHideBehavior)); |
573 | 636 |
574 // Note: To maintain sync compatibility with old images of chrome/chromeos | 637 // Note: To maintain sync compatibility with old images of chrome/chromeos |
575 // the set of values that may be encountered includes the now-extinct | 638 // the set of values that may be encountered includes the now-extinct |
576 // "Default" as well as "Never" and "Always", "Default" should now | 639 // "Default" as well as "Never" and "Always", "Default" should now |
577 // be treated as "Never" (http://crbug.com/146773). | 640 // be treated as "Never" (http://crbug.com/146773). |
578 if (behavior_value == ash::kShelfAutoHideBehaviorAlways) | 641 if (behavior_value == ash::kShelfAutoHideBehaviorAlways) |
579 return ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS; | 642 return ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS; |
580 return ash::SHELF_AUTO_HIDE_BEHAVIOR_NEVER; | 643 return ash::SHELF_AUTO_HIDE_BEHAVIOR_NEVER; |
581 } | 644 } |
582 | 645 |
583 bool ChromeLauncherControllerPerApp::CanUserModifyShelfAutoHideBehavior( | 646 bool ChromeLauncherControllerPerApp::CanUserModifyShelfAutoHideBehavior( |
584 aura::RootWindow* root_window) const { | 647 aura::RootWindow* root_window) const { |
585 // TODO(oshima): Support multiple launchers. | |
586 return profile_->GetPrefs()-> | 648 return profile_->GetPrefs()-> |
587 FindPreference(prefs::kShelfAutoHideBehaviorLocal)->IsUserModifiable(); | 649 FindPreference(prefs::kShelfAutoHideBehaviorLocal)->IsUserModifiable(); |
588 } | 650 } |
589 | 651 |
590 void ChromeLauncherControllerPerApp::ToggleShelfAutoHideBehavior( | 652 void ChromeLauncherControllerPerApp::ToggleShelfAutoHideBehavior( |
591 aura::RootWindow* root_window) { | 653 aura::RootWindow* root_window) { |
592 ash::ShelfAutoHideBehavior behavior = GetShelfAutoHideBehavior(root_window) == | 654 ash::ShelfAutoHideBehavior behavior = GetShelfAutoHideBehavior(root_window) == |
593 ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS ? | 655 ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS ? |
594 ash::SHELF_AUTO_HIDE_BEHAVIOR_NEVER : | 656 ash::SHELF_AUTO_HIDE_BEHAVIOR_NEVER : |
595 ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS; | 657 ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS; |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
790 if (IsAppPinned(extension->id())) | 852 if (IsAppPinned(extension->id())) |
791 DoUnpinAppsWithID(extension->id()); | 853 DoUnpinAppsWithID(extension->id()); |
792 app_icon_loader_->ClearImage(extension->id()); | 854 app_icon_loader_->ClearImage(extension->id()); |
793 break; | 855 break; |
794 } | 856 } |
795 default: | 857 default: |
796 NOTREACHED() << "Unexpected notification type=" << type; | 858 NOTREACHED() << "Unexpected notification type=" << type; |
797 } | 859 } |
798 } | 860 } |
799 | 861 |
800 void ChromeLauncherControllerPerApp::OnShelfAlignmentChanged() { | 862 void ChromeLauncherControllerPerApp::OnShelfAlignmentChanged( |
863 aura::RootWindow* root_window) { | |
801 const char* pref_value = NULL; | 864 const char* pref_value = NULL; |
802 // TODO(oshima): Support multiple displays. | 865 switch (ash::Shell::GetInstance()->GetShelfAlignment(root_window)) { |
803 switch (ash::Shell::GetInstance()->GetShelfAlignment( | |
804 ash::Shell::GetPrimaryRootWindow())) { | |
805 case ash::SHELF_ALIGNMENT_BOTTOM: | 866 case ash::SHELF_ALIGNMENT_BOTTOM: |
806 pref_value = ash::kShelfAlignmentBottom; | 867 pref_value = ash::kShelfAlignmentBottom; |
807 break; | 868 break; |
808 case ash::SHELF_ALIGNMENT_LEFT: | 869 case ash::SHELF_ALIGNMENT_LEFT: |
809 pref_value = ash::kShelfAlignmentLeft; | 870 pref_value = ash::kShelfAlignmentLeft; |
810 break; | 871 break; |
811 case ash::SHELF_ALIGNMENT_RIGHT: | 872 case ash::SHELF_ALIGNMENT_RIGHT: |
812 pref_value = ash::kShelfAlignmentRight; | 873 pref_value = ash::kShelfAlignmentRight; |
813 break; | 874 break; |
814 } | 875 } |
815 // See comment in |kShelfAlignment| about why we have two prefs here. | 876 |
816 profile_->GetPrefs()->SetString(prefs::kShelfAlignmentLocal, pref_value); | 877 UpdatePerDisplayPref( |
817 profile_->GetPrefs()->SetString(prefs::kShelfAlignment, pref_value); | 878 profile_->GetPrefs(), root_window, prefs::kShelfAlignment, pref_value); |
879 | |
880 if (root_window == ash::Shell::GetPrimaryRootWindow()) { | |
881 // See comment in |kShelfAlignment| about why we have two prefs here. | |
882 profile_->GetPrefs()->SetString(prefs::kShelfAlignmentLocal, pref_value); | |
883 profile_->GetPrefs()->SetString(prefs::kShelfAlignment, pref_value); | |
884 } | |
818 } | 885 } |
819 | 886 |
820 void ChromeLauncherControllerPerApp::OnIsSyncingChanged() { | 887 void ChromeLauncherControllerPerApp::OnIsSyncingChanged() { |
821 MaybePropagatePrefToLocal(profile_->GetPrefs(), | 888 MaybePropagatePrefToLocal(profile_->GetPrefs(), |
822 prefs::kShelfAlignmentLocal, | 889 prefs::kShelfAlignmentLocal, |
823 prefs::kShelfAlignment); | 890 prefs::kShelfAlignment); |
824 MaybePropagatePrefToLocal(profile_->GetPrefs(), | 891 MaybePropagatePrefToLocal(profile_->GetPrefs(), |
825 prefs::kShelfAutoHideBehaviorLocal, | 892 prefs::kShelfAutoHideBehaviorLocal, |
826 prefs::kShelfAutoHideBehavior); | 893 prefs::kShelfAutoHideBehavior); |
827 } | 894 } |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
982 } | 1049 } |
983 | 1050 |
984 // Append unprocessed items from the pref to the end of the model. | 1051 // Append unprocessed items from the pref to the end of the model. |
985 for (; pref_app_id != pinned_apps.end(); ++pref_app_id) | 1052 for (; pref_app_id != pinned_apps.end(); ++pref_app_id) |
986 DoPinAppWithID(*pref_app_id); | 1053 DoPinAppWithID(*pref_app_id); |
987 } | 1054 } |
988 | 1055 |
989 void ChromeLauncherControllerPerApp::SetShelfAutoHideBehaviorPrefs( | 1056 void ChromeLauncherControllerPerApp::SetShelfAutoHideBehaviorPrefs( |
990 ash::ShelfAutoHideBehavior behavior, | 1057 ash::ShelfAutoHideBehavior behavior, |
991 aura::RootWindow* root_window) { | 1058 aura::RootWindow* root_window) { |
992 // TODO(oshima): Support multiple launchers. | |
993 if (root_window != ash::Shell::GetPrimaryRootWindow()) | |
994 return; | |
995 | |
996 const char* value = NULL; | 1059 const char* value = NULL; |
997 switch (behavior) { | 1060 switch (behavior) { |
998 case ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS: | 1061 case ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS: |
999 value = ash::kShelfAutoHideBehaviorAlways; | 1062 value = ash::kShelfAutoHideBehaviorAlways; |
1000 break; | 1063 break; |
1001 case ash::SHELF_AUTO_HIDE_BEHAVIOR_NEVER: | 1064 case ash::SHELF_AUTO_HIDE_BEHAVIOR_NEVER: |
1002 value = ash::kShelfAutoHideBehaviorNever; | 1065 value = ash::kShelfAutoHideBehaviorNever; |
1003 break; | 1066 break; |
1004 } | 1067 } |
1005 // See comment in |kShelfAlignment| about why we have two prefs here. | 1068 |
1006 profile_->GetPrefs()->SetString(prefs::kShelfAutoHideBehaviorLocal, value); | 1069 UpdatePerDisplayPref( |
1007 profile_->GetPrefs()->SetString(prefs::kShelfAutoHideBehavior, value); | 1070 profile_->GetPrefs(), root_window, prefs::kShelfAutoHideBehavior, value); |
1071 | |
1072 if (root_window == ash::Shell::GetPrimaryRootWindow()) { | |
1073 // See comment in |kShelfAlignment| about why we have two prefs here. | |
1074 profile_->GetPrefs()->SetString(prefs::kShelfAutoHideBehaviorLocal, value); | |
1075 profile_->GetPrefs()->SetString(prefs::kShelfAutoHideBehavior, value); | |
1076 } | |
1008 } | 1077 } |
1009 | 1078 |
1010 void ChromeLauncherControllerPerApp::SetShelfAutoHideBehaviorFromPrefs() { | 1079 void ChromeLauncherControllerPerApp::SetShelfAutoHideBehaviorFromPrefs() { |
1011 // TODO(oshima): Support multiple displays. | 1080 ash::Shell::RootWindowList root_windows = ash::Shell::GetAllRootWindows(); |
1012 aura::RootWindow* root_window = ash::Shell::GetPrimaryRootWindow(); | 1081 for (ash::Shell::RootWindowList::const_iterator iter = root_windows.begin(); |
1013 ash::Shell::GetInstance()->SetShelfAutoHideBehavior( | 1082 iter != root_windows.end(); ++iter) { |
1014 GetShelfAutoHideBehavior(root_window), root_window); | 1083 ash::Shell::GetInstance()->SetShelfAutoHideBehavior( |
1084 GetShelfAutoHideBehavior(*iter), *iter); | |
1085 } | |
1015 } | 1086 } |
1016 | 1087 |
1017 void ChromeLauncherControllerPerApp::SetShelfAlignmentFromPrefs() { | 1088 void ChromeLauncherControllerPerApp::SetShelfAlignmentFromPrefs() { |
1018 if (!CommandLine::ForCurrentProcess()->HasSwitch( | 1089 if (!CommandLine::ForCurrentProcess()->HasSwitch( |
1019 switches::kShowLauncherAlignmentMenu)) | 1090 switches::kShowLauncherAlignmentMenu)) |
1020 return; | 1091 return; |
1021 | 1092 |
1022 // See comment in |kShelfAlignment| as to why we consider two prefs. | 1093 ash::Shell::RootWindowList root_windows = ash::Shell::GetAllRootWindows(); |
1023 const std::string alignment_value( | 1094 for (ash::Shell::RootWindowList::const_iterator iter = root_windows.begin(); |
1024 GetLocalOrRemotePref(profile_->GetPrefs(), | 1095 iter != root_windows.end(); ++iter) { |
1025 prefs::kShelfAlignmentLocal, | 1096 // See comment in |kShelfAlignment| as to why we consider two prefs. |
1026 prefs::kShelfAlignment)); | 1097 const std::string alignment_value( |
1027 ash::ShelfAlignment alignment = ash::SHELF_ALIGNMENT_BOTTOM; | 1098 GetPrefForRootWindow(profile_->GetPrefs(), |
1028 if (alignment_value == ash::kShelfAlignmentLeft) | 1099 *iter, |
1029 alignment = ash::SHELF_ALIGNMENT_LEFT; | 1100 prefs::kShelfAlignmentLocal, |
1030 else if (alignment_value == ash::kShelfAlignmentRight) | 1101 prefs::kShelfAlignment)); |
1031 alignment = ash::SHELF_ALIGNMENT_RIGHT; | 1102 ash::ShelfAlignment alignment = ash::SHELF_ALIGNMENT_BOTTOM; |
1032 // TODO(oshima): Support multiple displays. | 1103 if (alignment_value == ash::kShelfAlignmentLeft) |
1033 ash::Shell::GetInstance()->SetShelfAlignment( | 1104 alignment = ash::SHELF_ALIGNMENT_LEFT; |
1034 alignment, ash::Shell::GetPrimaryRootWindow()); | 1105 else if (alignment_value == ash::kShelfAlignmentRight) |
1106 alignment = ash::SHELF_ALIGNMENT_RIGHT; | |
1107 ash::Shell::GetInstance()->SetShelfAlignment(alignment, *iter); | |
1108 } | |
1035 } | 1109 } |
1036 | 1110 |
1037 WebContents* ChromeLauncherControllerPerApp::GetLastActiveWebContents( | 1111 WebContents* ChromeLauncherControllerPerApp::GetLastActiveWebContents( |
1038 const std::string& app_id) { | 1112 const std::string& app_id) { |
1039 AppIDToWebContentsListMap::const_iterator i = | 1113 AppIDToWebContentsListMap::const_iterator i = |
1040 app_id_to_web_contents_list_.find(app_id); | 1114 app_id_to_web_contents_list_.find(app_id); |
1041 if (i == app_id_to_web_contents_list_.end()) | 1115 if (i == app_id_to_web_contents_list_.end()) |
1042 return NULL; | 1116 return NULL; |
1043 DCHECK_GT(i->second.size(), 0u); | 1117 DCHECK_GT(i->second.size(), 0u); |
1044 return *i->second.begin(); | 1118 return *i->second.begin(); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1103 void ChromeLauncherControllerPerApp::SetAppIconLoaderForTest( | 1177 void ChromeLauncherControllerPerApp::SetAppIconLoaderForTest( |
1104 AppIconLoader* loader) { | 1178 AppIconLoader* loader) { |
1105 app_icon_loader_.reset(loader); | 1179 app_icon_loader_.reset(loader); |
1106 } | 1180 } |
1107 | 1181 |
1108 const std::string& | 1182 const std::string& |
1109 ChromeLauncherControllerPerApp::GetAppIdFromLauncherIdForTest( | 1183 ChromeLauncherControllerPerApp::GetAppIdFromLauncherIdForTest( |
1110 ash::LauncherID id) { | 1184 ash::LauncherID id) { |
1111 return id_to_item_controller_map_[id]->app_id(); | 1185 return id_to_item_controller_map_[id]->app_id(); |
1112 } | 1186 } |
OLD | NEW |