OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
bartfab (slow)
2012/12/14 23:07:18
As usual, same comment as in the other file.
Jun Mukai
2012/12/14 23:40:56
Done.
| |
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_browser. h" | 5 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_browser. 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
112 | 114 |
113 // Stores the optional refocus url pattern for this item. | 115 // Stores the optional refocus url pattern for this item. |
114 const GURL& refocus_url() const { return refocus_url_; } | 116 const GURL& refocus_url() const { return refocus_url_; } |
115 void set_refocus_url(const GURL& refocus_url) { refocus_url_ = refocus_url; } | 117 void set_refocus_url(const GURL& refocus_url) { refocus_url_ = refocus_url; } |
116 | 118 |
117 private: | 119 private: |
118 GURL refocus_url_; | 120 GURL refocus_url_; |
119 DISALLOW_COPY_AND_ASSIGN(AppShortcutLauncherItemController); | 121 DISALLOW_COPY_AND_ASSIGN(AppShortcutLauncherItemController); |
120 }; | 122 }; |
121 | 123 |
122 // If the value of the pref at |local_path is not empty, it is returned | 124 std::string GetPrefKeyForRootWindow(aura::RootWindow* root_window) { |
123 // otherwise the value of the pref at |synced_path| is returned. | 125 gfx::Display display = gfx::Screen::GetScreenFor( |
124 std::string GetLocalOrRemotePref(PrefService* pref_service, | 126 root_window)->GetDisplayNearestWindow(root_window); |
127 DCHECK(display.is_valid()); | |
128 | |
129 return base::Int64ToString(display.id()); | |
130 } | |
131 | |
132 void UpdatePerDisplayPref(PrefService* pref_service, | |
133 aura::RootWindow* root_window, | |
134 const char* pref_key, | |
135 const std::string& value) { | |
136 std::string key = GetPrefKeyForRootWindow(root_window); | |
137 if (key.empty()) | |
138 return; | |
139 | |
140 DictionaryPrefUpdate update(pref_service, prefs::kShelfPreferences); | |
141 base::DictionaryValue* shelf_prefs = update.Get(); | |
142 base::DictionaryValue* prefs = NULL; | |
143 if (!shelf_prefs->GetDictionary(key, &prefs)) { | |
144 prefs = new base::DictionaryValue(); | |
145 shelf_prefs->Set(key, prefs); | |
146 } | |
147 prefs->SetStringWithoutPathExpansion(pref_key, value); | |
148 } | |
149 | |
150 // Returns a pref value in |pref_service| for the display of |root_window|. The | |
151 // pref value is stored in |local_path| and |path|, but |pref_service| may have | |
152 // per-display preferences and the value can be specified by policy. Here is | |
153 // the priority: | |
154 // * A value managed by policy. This is a single value that applies to all | |
155 // displays. | |
156 // * A user-set value for the specified display. | |
157 // * A user-set value in |local_path| or |path|. |local_path| is preferred. See | |
158 // comment in |kShelfAlignment| as to why we consider two prefs and why | |
159 // |local_path| is preferred. | |
160 // * A value recommended by policy. This is a single value that applies to all | |
161 // root windows. | |
162 std::string GetPrefForRootWindow(PrefService* pref_service, | |
163 aura::RootWindow* root_window, | |
125 const char* local_path, | 164 const char* local_path, |
126 const char* synced_path) { | 165 const char* path) { |
166 const PrefService::Preference* local_pref = | |
167 pref_service->FindPreference(local_path); | |
127 const std::string value(pref_service->GetString(local_path)); | 168 const std::string value(pref_service->GetString(local_path)); |
128 return value.empty() ? pref_service->GetString(synced_path) : value; | 169 if (local_pref->IsManaged()) |
170 return value; | |
171 | |
172 std::string pref_key = GetPrefKeyForRootWindow(root_window); | |
173 if (!pref_key.empty()) { | |
174 const base::DictionaryValue* shelf_prefs = pref_service->GetDictionary( | |
175 prefs::kShelfPreferences); | |
176 const base::DictionaryValue* display_pref = NULL; | |
177 std::string per_display_value; | |
178 if (shelf_prefs->GetDictionary(pref_key, &display_pref) && | |
179 display_pref->GetString(path, &per_display_value)) { | |
180 return per_display_value; | |
181 } | |
182 } | |
183 | |
184 if (!local_pref->HasUserSetting() && | |
185 pref_service->FindPreference(path)->HasUserSetting()) { | |
186 return pref_service->GetString(path); | |
187 } | |
188 | |
189 if (local_pref->IsRecommended()) | |
190 return value; | |
191 | |
192 return value.empty() ? pref_service->GetString(path) : value; | |
129 } | 193 } |
130 | 194 |
131 // If prefs have synced and no user-set value exists at |local_path|, the value | 195 // If prefs have synced and no user-set value exists at |local_path|, the value |
132 // from |synced_path| is copied to |local_path|. | 196 // from |synced_path| is copied to |local_path|. |
133 void MaybePropagatePrefToLocal(PrefService* pref_service, | 197 void MaybePropagatePrefToLocal(PrefService* pref_service, |
134 const char* local_path, | 198 const char* local_path, |
135 const char* synced_path) { | 199 const char* synced_path) { |
136 if (!pref_service->FindPreference(local_path)->HasUserSetting() && | 200 if (!pref_service->FindPreference(local_path)->HasUserSetting() && |
137 pref_service->IsSyncing()) { | 201 pref_service->IsSyncing()) { |
138 // First time the user is using this machine, propagate from remote to | 202 // First time the user is using this machine, propagate from remote to |
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
563 | 627 |
564 bool ChromeLauncherControllerPerBrowser::CanPin() const { | 628 bool ChromeLauncherControllerPerBrowser::CanPin() const { |
565 const PrefService::Preference* pref = | 629 const PrefService::Preference* pref = |
566 profile_->GetPrefs()->FindPreference(prefs::kPinnedLauncherApps); | 630 profile_->GetPrefs()->FindPreference(prefs::kPinnedLauncherApps); |
567 return pref && pref->IsUserModifiable(); | 631 return pref && pref->IsUserModifiable(); |
568 } | 632 } |
569 | 633 |
570 ash::ShelfAutoHideBehavior | 634 ash::ShelfAutoHideBehavior |
571 ChromeLauncherControllerPerBrowser::GetShelfAutoHideBehavior( | 635 ChromeLauncherControllerPerBrowser::GetShelfAutoHideBehavior( |
572 aura::RootWindow* root_window) const { | 636 aura::RootWindow* root_window) const { |
573 // TODO(oshima): Support multiple launchers. | |
574 | |
575 // See comment in |kShelfAlignment| as to why we consider two prefs. | 637 // See comment in |kShelfAlignment| as to why we consider two prefs. |
576 const std::string behavior_value( | 638 const std::string behavior_value( |
577 GetLocalOrRemotePref(profile_->GetPrefs(), | 639 GetPrefForRootWindow(profile_->GetPrefs(), |
640 root_window, | |
578 prefs::kShelfAutoHideBehaviorLocal, | 641 prefs::kShelfAutoHideBehaviorLocal, |
579 prefs::kShelfAutoHideBehavior)); | 642 prefs::kShelfAutoHideBehavior)); |
580 | 643 |
581 // Note: To maintain sync compatibility with old images of chrome/chromeos | 644 // Note: To maintain sync compatibility with old images of chrome/chromeos |
582 // the set of values that may be encountered includes the now-extinct | 645 // the set of values that may be encountered includes the now-extinct |
583 // "Default" as well as "Never" and "Always", "Default" should now | 646 // "Default" as well as "Never" and "Always", "Default" should now |
584 // be treated as "Never" (http://crbug.com/146773). | 647 // be treated as "Never" (http://crbug.com/146773). |
585 if (behavior_value == ash::kShelfAutoHideBehaviorAlways) | 648 if (behavior_value == ash::kShelfAutoHideBehaviorAlways) |
586 return ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS; | 649 return ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS; |
587 return ash::SHELF_AUTO_HIDE_BEHAVIOR_NEVER; | 650 return ash::SHELF_AUTO_HIDE_BEHAVIOR_NEVER; |
588 } | 651 } |
589 | 652 |
590 bool ChromeLauncherControllerPerBrowser::CanUserModifyShelfAutoHideBehavior( | 653 bool ChromeLauncherControllerPerBrowser::CanUserModifyShelfAutoHideBehavior( |
591 aura::RootWindow* root_window) const { | 654 aura::RootWindow* root_window) const { |
592 // TODO(oshima): Support multiple launchers. | |
593 return profile_->GetPrefs()-> | 655 return profile_->GetPrefs()-> |
594 FindPreference(prefs::kShelfAutoHideBehaviorLocal)->IsUserModifiable(); | 656 FindPreference(prefs::kShelfAutoHideBehaviorLocal)->IsUserModifiable(); |
595 } | 657 } |
596 | 658 |
597 void ChromeLauncherControllerPerBrowser::ToggleShelfAutoHideBehavior( | 659 void ChromeLauncherControllerPerBrowser::ToggleShelfAutoHideBehavior( |
598 aura::RootWindow* root_window) { | 660 aura::RootWindow* root_window) { |
599 ash::ShelfAutoHideBehavior behavior = GetShelfAutoHideBehavior(root_window) == | 661 ash::ShelfAutoHideBehavior behavior = GetShelfAutoHideBehavior(root_window) == |
600 ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS ? | 662 ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS ? |
601 ash::SHELF_AUTO_HIDE_BEHAVIOR_NEVER : | 663 ash::SHELF_AUTO_HIDE_BEHAVIOR_NEVER : |
602 ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS; | 664 ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS; |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
798 if (IsAppPinned(extension->id())) | 860 if (IsAppPinned(extension->id())) |
799 DoUnpinAppsWithID(extension->id()); | 861 DoUnpinAppsWithID(extension->id()); |
800 app_icon_loader_->ClearImage(extension->id()); | 862 app_icon_loader_->ClearImage(extension->id()); |
801 break; | 863 break; |
802 } | 864 } |
803 default: | 865 default: |
804 NOTREACHED() << "Unexpected notification type=" << type; | 866 NOTREACHED() << "Unexpected notification type=" << type; |
805 } | 867 } |
806 } | 868 } |
807 | 869 |
808 void ChromeLauncherControllerPerBrowser::OnShelfAlignmentChanged() { | 870 void ChromeLauncherControllerPerBrowser::OnShelfAlignmentChanged( |
871 aura::RootWindow* root_window) { | |
809 const char* pref_value = NULL; | 872 const char* pref_value = NULL; |
810 // TODO(oshima): Support multiple displays. | 873 switch (ash::Shell::GetInstance()->GetShelfAlignment(root_window)) { |
811 switch (ash::Shell::GetInstance()->GetShelfAlignment( | |
812 ash::Shell::GetPrimaryRootWindow())) { | |
813 case ash::SHELF_ALIGNMENT_BOTTOM: | 874 case ash::SHELF_ALIGNMENT_BOTTOM: |
814 pref_value = ash::kShelfAlignmentBottom; | 875 pref_value = ash::kShelfAlignmentBottom; |
815 break; | 876 break; |
816 case ash::SHELF_ALIGNMENT_LEFT: | 877 case ash::SHELF_ALIGNMENT_LEFT: |
817 pref_value = ash::kShelfAlignmentLeft; | 878 pref_value = ash::kShelfAlignmentLeft; |
818 break; | 879 break; |
819 case ash::SHELF_ALIGNMENT_RIGHT: | 880 case ash::SHELF_ALIGNMENT_RIGHT: |
820 pref_value = ash::kShelfAlignmentRight; | 881 pref_value = ash::kShelfAlignmentRight; |
821 break; | 882 break; |
822 } | 883 } |
823 // See comment in |kShelfAlignment| about why we have two prefs here. | 884 |
824 profile_->GetPrefs()->SetString(prefs::kShelfAlignmentLocal, pref_value); | 885 UpdatePerDisplayPref( |
825 profile_->GetPrefs()->SetString(prefs::kShelfAlignment, pref_value); | 886 profile_->GetPrefs(), root_window, prefs::kShelfAlignment, pref_value); |
887 | |
888 if (root_window == ash::Shell::GetPrimaryRootWindow()) { | |
889 // See comment in |kShelfAlignment| about why we have two prefs here. | |
890 profile_->GetPrefs()->SetString(prefs::kShelfAlignmentLocal, pref_value); | |
891 profile_->GetPrefs()->SetString(prefs::kShelfAlignment, pref_value); | |
892 } | |
826 } | 893 } |
827 | 894 |
828 void ChromeLauncherControllerPerBrowser::OnIsSyncingChanged() { | 895 void ChromeLauncherControllerPerBrowser::OnIsSyncingChanged() { |
829 MaybePropagatePrefToLocal(profile_->GetPrefs(), | 896 MaybePropagatePrefToLocal(profile_->GetPrefs(), |
830 prefs::kShelfAlignmentLocal, | 897 prefs::kShelfAlignmentLocal, |
831 prefs::kShelfAlignment); | 898 prefs::kShelfAlignment); |
832 MaybePropagatePrefToLocal(profile_->GetPrefs(), | 899 MaybePropagatePrefToLocal(profile_->GetPrefs(), |
833 prefs::kShelfAutoHideBehaviorLocal, | 900 prefs::kShelfAutoHideBehaviorLocal, |
834 prefs::kShelfAutoHideBehavior); | 901 prefs::kShelfAutoHideBehavior); |
835 } | 902 } |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
992 } | 1059 } |
993 | 1060 |
994 // Append unprocessed items from the pref to the end of the model. | 1061 // Append unprocessed items from the pref to the end of the model. |
995 for (; pref_app_id != pinned_apps.end(); ++pref_app_id) | 1062 for (; pref_app_id != pinned_apps.end(); ++pref_app_id) |
996 DoPinAppWithID(*pref_app_id); | 1063 DoPinAppWithID(*pref_app_id); |
997 } | 1064 } |
998 | 1065 |
999 void ChromeLauncherControllerPerBrowser::SetShelfAutoHideBehaviorPrefs( | 1066 void ChromeLauncherControllerPerBrowser::SetShelfAutoHideBehaviorPrefs( |
1000 ash::ShelfAutoHideBehavior behavior, | 1067 ash::ShelfAutoHideBehavior behavior, |
1001 aura::RootWindow* root_window) { | 1068 aura::RootWindow* root_window) { |
1002 // TODO(oshima): Support multiple launchers. | |
1003 if (root_window != ash::Shell::GetPrimaryRootWindow()) | |
1004 return; | |
1005 | |
1006 const char* value = NULL; | 1069 const char* value = NULL; |
1007 switch (behavior) { | 1070 switch (behavior) { |
1008 case ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS: | 1071 case ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS: |
1009 value = ash::kShelfAutoHideBehaviorAlways; | 1072 value = ash::kShelfAutoHideBehaviorAlways; |
1010 break; | 1073 break; |
1011 case ash::SHELF_AUTO_HIDE_BEHAVIOR_NEVER: | 1074 case ash::SHELF_AUTO_HIDE_BEHAVIOR_NEVER: |
1012 value = ash::kShelfAutoHideBehaviorNever; | 1075 value = ash::kShelfAutoHideBehaviorNever; |
1013 break; | 1076 break; |
1014 } | 1077 } |
1015 // See comment in |kShelfAlignment| about why we have two prefs here. | 1078 |
1016 profile_->GetPrefs()->SetString(prefs::kShelfAutoHideBehaviorLocal, value); | 1079 UpdatePerDisplayPref( |
1017 profile_->GetPrefs()->SetString(prefs::kShelfAutoHideBehavior, value); | 1080 profile_->GetPrefs(), root_window, prefs::kShelfAutoHideBehavior, value); |
1081 | |
1082 if (root_window != ash::Shell::GetPrimaryRootWindow()) { | |
1083 // See comment in |kShelfAlignment| about why we have two prefs here. | |
1084 profile_->GetPrefs()->SetString(prefs::kShelfAutoHideBehaviorLocal, value); | |
1085 profile_->GetPrefs()->SetString(prefs::kShelfAutoHideBehavior, value); | |
1086 } | |
1018 } | 1087 } |
1019 | 1088 |
1020 void ChromeLauncherControllerPerBrowser::SetShelfAutoHideBehaviorFromPrefs() { | 1089 void ChromeLauncherControllerPerBrowser::SetShelfAutoHideBehaviorFromPrefs() { |
1021 // TODO(oshima): Support multiple displays. | 1090 ash::Shell::RootWindowList root_windows = ash::Shell::GetAllRootWindows(); |
1022 aura::RootWindow* root_window = ash::Shell::GetPrimaryRootWindow(); | 1091 for (ash::Shell::RootWindowList::const_iterator iter = root_windows.begin(); |
1023 ash::Shell::GetInstance()->SetShelfAutoHideBehavior( | 1092 iter != root_windows.end(); ++iter) { |
1024 GetShelfAutoHideBehavior(root_window), root_window); | 1093 ash::Shell::GetInstance()->SetShelfAutoHideBehavior( |
1094 GetShelfAutoHideBehavior(*iter), *iter); | |
1095 } | |
1025 } | 1096 } |
1026 | 1097 |
1027 void ChromeLauncherControllerPerBrowser::SetShelfAlignmentFromPrefs() { | 1098 void ChromeLauncherControllerPerBrowser::SetShelfAlignmentFromPrefs() { |
1028 if (!CommandLine::ForCurrentProcess()->HasSwitch( | 1099 if (!CommandLine::ForCurrentProcess()->HasSwitch( |
1029 switches::kShowLauncherAlignmentMenu)) | 1100 switches::kShowLauncherAlignmentMenu)) |
1030 return; | 1101 return; |
1031 | 1102 |
1032 // See comment in |kShelfAlignment| as to why we consider two prefs. | 1103 ash::Shell::RootWindowList root_windows = ash::Shell::GetAllRootWindows(); |
1033 const std::string alignment_value( | 1104 for (ash::Shell::RootWindowList::const_iterator iter = root_windows.begin(); |
1034 GetLocalOrRemotePref(profile_->GetPrefs(), | 1105 iter != root_windows.end(); ++iter) { |
1035 prefs::kShelfAlignmentLocal, | 1106 // See comment in |kShelfAlignment| as to why we consider two prefs. |
1036 prefs::kShelfAlignment)); | 1107 const std::string alignment_value( |
1037 ash::ShelfAlignment alignment = ash::SHELF_ALIGNMENT_BOTTOM; | 1108 GetPrefForRootWindow(profile_->GetPrefs(), |
1038 if (alignment_value == ash::kShelfAlignmentLeft) | 1109 *iter, |
1039 alignment = ash::SHELF_ALIGNMENT_LEFT; | 1110 prefs::kShelfAlignmentLocal, |
1040 else if (alignment_value == ash::kShelfAlignmentRight) | 1111 prefs::kShelfAlignment)); |
1041 alignment = ash::SHELF_ALIGNMENT_RIGHT; | 1112 ash::ShelfAlignment alignment = ash::SHELF_ALIGNMENT_BOTTOM; |
1042 // TODO(oshima): Support multiple displays. | 1113 if (alignment_value == ash::kShelfAlignmentLeft) |
1043 ash::Shell::GetInstance()->SetShelfAlignment( | 1114 alignment = ash::SHELF_ALIGNMENT_LEFT; |
1044 alignment, ash::Shell::GetPrimaryRootWindow()); | 1115 else if (alignment_value == ash::kShelfAlignmentRight) |
1116 alignment = ash::SHELF_ALIGNMENT_RIGHT; | |
1117 ash::Shell::GetInstance()->SetShelfAlignment(alignment, *iter); | |
1118 } | |
1045 } | 1119 } |
1046 | 1120 |
1047 WebContents* ChromeLauncherControllerPerBrowser::GetLastActiveWebContents( | 1121 WebContents* ChromeLauncherControllerPerBrowser::GetLastActiveWebContents( |
1048 const std::string& app_id) { | 1122 const std::string& app_id) { |
1049 AppIDToWebContentsListMap::const_iterator i = | 1123 AppIDToWebContentsListMap::const_iterator i = |
1050 app_id_to_web_contents_list_.find(app_id); | 1124 app_id_to_web_contents_list_.find(app_id); |
1051 if (i == app_id_to_web_contents_list_.end()) | 1125 if (i == app_id_to_web_contents_list_.end()) |
1052 return NULL; | 1126 return NULL; |
1053 DCHECK_GT(i->second.size(), 0u); | 1127 DCHECK_GT(i->second.size(), 0u); |
1054 return *i->second.begin(); | 1128 return *i->second.begin(); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1114 void ChromeLauncherControllerPerBrowser::SetAppIconLoaderForTest( | 1188 void ChromeLauncherControllerPerBrowser::SetAppIconLoaderForTest( |
1115 AppIconLoader* loader) { | 1189 AppIconLoader* loader) { |
1116 app_icon_loader_.reset(loader); | 1190 app_icon_loader_.reset(loader); |
1117 } | 1191 } |
1118 | 1192 |
1119 const std::string& | 1193 const std::string& |
1120 ChromeLauncherControllerPerBrowser::GetAppIdFromLauncherIdForTest( | 1194 ChromeLauncherControllerPerBrowser::GetAppIdFromLauncherIdForTest( |
1121 ash::LauncherID id) { | 1195 ash::LauncherID id) { |
1122 return id_to_item_controller_map_[id]->app_id(); | 1196 return id_to_item_controller_map_[id]->app_id(); |
1123 } | 1197 } |
OLD | NEW |