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 the pref in |pref_service| for |root_window|. The pref value | |
bartfab (slow)
2012/12/14 21:34:02
Nit: "Returns a pref value from |pref_service| for
Jun Mukai
2012/12/14 22:44:56
Done.
| |
150 // can vary among root windows and can be specified by the admin. Here is | |
151 // the priority: | |
bartfab (slow)
2012/12/14 21:34:02
Nit: Turn the bullet points into faux sentences (c
Jun Mukai
2012/12/14 22:44:56
Done.
| |
152 // * the value managed by the admin | |
bartfab (slow)
2012/12/14 21:34:02
1/ "Managed by the admin" is not the wording we us
Jun Mukai
2012/12/14 22:44:56
Done.
| |
153 // * a user-set value specific to the root window | |
154 // * the value recommended by the admin | |
bartfab (slow)
2012/12/14 21:34:02
1/ "Recommended by the admin" is not the wording w
Jun Mukai
2012/12/14 22:44:56
Done.
| |
155 // * otherwise, lookup the default value. |local_path| is preferred. | |
bartfab (slow)
2012/12/14 21:34:02
Nit: "look up" (two words).
bartfab (slow)
2012/12/14 21:34:02
"|local_path| is preferred" actually hides a lot o
Jun Mukai
2012/12/14 22:44:56
Done.
Jun Mukai
2012/12/14 22:44:56
This is slightly wrong actually. User-set value s
| |
156 std::string GetPrefForRootWindow(PrefService* pref_service, | |
157 aura::RootWindow* root_window, | |
124 const char* local_path, | 158 const char* local_path, |
125 const char* synced_path) { | 159 const char* path) { |
160 const PrefService::Preference* local_pref = | |
161 pref_service->FindPreference(local_path); | |
126 const std::string value(pref_service->GetString(local_path)); | 162 const std::string value(pref_service->GetString(local_path)); |
127 return value.empty() ? pref_service->GetString(synced_path) : value; | 163 if (local_pref->IsManaged()) |
164 return value; | |
165 | |
166 std::string pref_key = GetPrefKeyForRootWindow(root_window); | |
167 if (!pref_key.empty()) { | |
168 const base::DictionaryValue* shelf_prefs = pref_service->GetDictionary( | |
169 prefs::kShelfPreferences); | |
170 const base::DictionaryValue* display_pref = NULL; | |
171 std::string per_display_value; | |
172 if (shelf_prefs->GetDictionary(pref_key, &display_pref) && | |
173 display_pref->GetString(path, &per_display_value)) { | |
174 return per_display_value; | |
175 } | |
176 } | |
177 | |
178 if (local_pref->IsRecommended()) | |
bartfab (slow)
2012/12/14 21:34:02
This will work but I want to double-check the logi
Jun Mukai
2012/12/14 22:44:56
You make the point. Sure, the user pref from sync
| |
179 return value; | |
180 | |
181 return value.empty() ? pref_service->GetString(path) : value; | |
128 } | 182 } |
129 | 183 |
130 // If prefs have synced and no user-set value exists at |local_path|, the value | 184 // If prefs have synced and no user-set value exists at |local_path|, the value |
131 // from |synced_path| is copied to |local_path|. | 185 // from |synced_path| is copied to |local_path|. |
132 void MaybePropagatePrefToLocal(PrefService* pref_service, | 186 void MaybePropagatePrefToLocal(PrefService* pref_service, |
133 const char* local_path, | 187 const char* local_path, |
134 const char* synced_path) { | 188 const char* synced_path) { |
135 if (!pref_service->FindPreference(local_path)->HasUserSetting() && | 189 if (!pref_service->FindPreference(local_path)->HasUserSetting() && |
136 pref_service->IsSyncing()) { | 190 pref_service->IsSyncing()) { |
137 // First time the user is using this machine, propagate from remote to | 191 // 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 | 610 |
557 bool ChromeLauncherControllerPerApp::CanPin() const { | 611 bool ChromeLauncherControllerPerApp::CanPin() const { |
558 const PrefService::Preference* pref = | 612 const PrefService::Preference* pref = |
559 profile_->GetPrefs()->FindPreference(prefs::kPinnedLauncherApps); | 613 profile_->GetPrefs()->FindPreference(prefs::kPinnedLauncherApps); |
560 return pref && pref->IsUserModifiable(); | 614 return pref && pref->IsUserModifiable(); |
561 } | 615 } |
562 | 616 |
563 ash::ShelfAutoHideBehavior | 617 ash::ShelfAutoHideBehavior |
564 ChromeLauncherControllerPerApp::GetShelfAutoHideBehavior( | 618 ChromeLauncherControllerPerApp::GetShelfAutoHideBehavior( |
565 aura::RootWindow* root_window) const { | 619 aura::RootWindow* root_window) const { |
566 // TODO(oshima): Support multiple launchers. | |
567 | |
568 // See comment in |kShelfAlignment| as to why we consider two prefs. | 620 // See comment in |kShelfAlignment| as to why we consider two prefs. |
569 const std::string behavior_value( | 621 const std::string behavior_value( |
570 GetLocalOrRemotePref(profile_->GetPrefs(), | 622 GetPrefForRootWindow(profile_->GetPrefs(), |
623 root_window, | |
571 prefs::kShelfAutoHideBehaviorLocal, | 624 prefs::kShelfAutoHideBehaviorLocal, |
572 prefs::kShelfAutoHideBehavior)); | 625 prefs::kShelfAutoHideBehavior)); |
573 | 626 |
574 // Note: To maintain sync compatibility with old images of chrome/chromeos | 627 // Note: To maintain sync compatibility with old images of chrome/chromeos |
575 // the set of values that may be encountered includes the now-extinct | 628 // the set of values that may be encountered includes the now-extinct |
576 // "Default" as well as "Never" and "Always", "Default" should now | 629 // "Default" as well as "Never" and "Always", "Default" should now |
577 // be treated as "Never" (http://crbug.com/146773). | 630 // be treated as "Never" (http://crbug.com/146773). |
578 if (behavior_value == ash::kShelfAutoHideBehaviorAlways) | 631 if (behavior_value == ash::kShelfAutoHideBehaviorAlways) |
579 return ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS; | 632 return ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS; |
580 return ash::SHELF_AUTO_HIDE_BEHAVIOR_NEVER; | 633 return ash::SHELF_AUTO_HIDE_BEHAVIOR_NEVER; |
581 } | 634 } |
582 | 635 |
583 bool ChromeLauncherControllerPerApp::CanUserModifyShelfAutoHideBehavior( | 636 bool ChromeLauncherControllerPerApp::CanUserModifyShelfAutoHideBehavior( |
584 aura::RootWindow* root_window) const { | 637 aura::RootWindow* root_window) const { |
585 // TODO(oshima): Support multiple launchers. | |
586 return profile_->GetPrefs()-> | 638 return profile_->GetPrefs()-> |
587 FindPreference(prefs::kShelfAutoHideBehaviorLocal)->IsUserModifiable(); | 639 FindPreference(prefs::kShelfAutoHideBehaviorLocal)->IsUserModifiable(); |
588 } | 640 } |
589 | 641 |
590 void ChromeLauncherControllerPerApp::ToggleShelfAutoHideBehavior( | 642 void ChromeLauncherControllerPerApp::ToggleShelfAutoHideBehavior( |
591 aura::RootWindow* root_window) { | 643 aura::RootWindow* root_window) { |
592 ash::ShelfAutoHideBehavior behavior = GetShelfAutoHideBehavior(root_window) == | 644 ash::ShelfAutoHideBehavior behavior = GetShelfAutoHideBehavior(root_window) == |
593 ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS ? | 645 ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS ? |
594 ash::SHELF_AUTO_HIDE_BEHAVIOR_NEVER : | 646 ash::SHELF_AUTO_HIDE_BEHAVIOR_NEVER : |
595 ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS; | 647 ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS; |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
790 if (IsAppPinned(extension->id())) | 842 if (IsAppPinned(extension->id())) |
791 DoUnpinAppsWithID(extension->id()); | 843 DoUnpinAppsWithID(extension->id()); |
792 app_icon_loader_->ClearImage(extension->id()); | 844 app_icon_loader_->ClearImage(extension->id()); |
793 break; | 845 break; |
794 } | 846 } |
795 default: | 847 default: |
796 NOTREACHED() << "Unexpected notification type=" << type; | 848 NOTREACHED() << "Unexpected notification type=" << type; |
797 } | 849 } |
798 } | 850 } |
799 | 851 |
800 void ChromeLauncherControllerPerApp::OnShelfAlignmentChanged() { | 852 void ChromeLauncherControllerPerApp::OnShelfAlignmentChanged( |
853 aura::RootWindow* root_window) { | |
801 const char* pref_value = NULL; | 854 const char* pref_value = NULL; |
802 // TODO(oshima): Support multiple displays. | 855 switch (ash::Shell::GetInstance()->GetShelfAlignment(root_window)) { |
803 switch (ash::Shell::GetInstance()->GetShelfAlignment( | |
804 ash::Shell::GetPrimaryRootWindow())) { | |
805 case ash::SHELF_ALIGNMENT_BOTTOM: | 856 case ash::SHELF_ALIGNMENT_BOTTOM: |
806 pref_value = ash::kShelfAlignmentBottom; | 857 pref_value = ash::kShelfAlignmentBottom; |
807 break; | 858 break; |
808 case ash::SHELF_ALIGNMENT_LEFT: | 859 case ash::SHELF_ALIGNMENT_LEFT: |
809 pref_value = ash::kShelfAlignmentLeft; | 860 pref_value = ash::kShelfAlignmentLeft; |
810 break; | 861 break; |
811 case ash::SHELF_ALIGNMENT_RIGHT: | 862 case ash::SHELF_ALIGNMENT_RIGHT: |
812 pref_value = ash::kShelfAlignmentRight; | 863 pref_value = ash::kShelfAlignmentRight; |
813 break; | 864 break; |
814 } | 865 } |
815 // See comment in |kShelfAlignment| about why we have two prefs here. | 866 |
816 profile_->GetPrefs()->SetString(prefs::kShelfAlignmentLocal, pref_value); | 867 UpdatePerDisplayPref( |
817 profile_->GetPrefs()->SetString(prefs::kShelfAlignment, pref_value); | 868 profile_->GetPrefs(), root_window, prefs::kShelfAlignment, pref_value); |
869 | |
870 if (root_window == ash::Shell::GetPrimaryRootWindow()) { | |
871 // See comment in |kShelfAlignment| about why we have two prefs here. | |
872 profile_->GetPrefs()->SetString(prefs::kShelfAlignmentLocal, pref_value); | |
873 profile_->GetPrefs()->SetString(prefs::kShelfAlignment, pref_value); | |
874 } | |
818 } | 875 } |
819 | 876 |
820 void ChromeLauncherControllerPerApp::OnIsSyncingChanged() { | 877 void ChromeLauncherControllerPerApp::OnIsSyncingChanged() { |
821 MaybePropagatePrefToLocal(profile_->GetPrefs(), | 878 MaybePropagatePrefToLocal(profile_->GetPrefs(), |
822 prefs::kShelfAlignmentLocal, | 879 prefs::kShelfAlignmentLocal, |
823 prefs::kShelfAlignment); | 880 prefs::kShelfAlignment); |
824 MaybePropagatePrefToLocal(profile_->GetPrefs(), | 881 MaybePropagatePrefToLocal(profile_->GetPrefs(), |
825 prefs::kShelfAutoHideBehaviorLocal, | 882 prefs::kShelfAutoHideBehaviorLocal, |
826 prefs::kShelfAutoHideBehavior); | 883 prefs::kShelfAutoHideBehavior); |
827 } | 884 } |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
982 } | 1039 } |
983 | 1040 |
984 // Append unprocessed items from the pref to the end of the model. | 1041 // Append unprocessed items from the pref to the end of the model. |
985 for (; pref_app_id != pinned_apps.end(); ++pref_app_id) | 1042 for (; pref_app_id != pinned_apps.end(); ++pref_app_id) |
986 DoPinAppWithID(*pref_app_id); | 1043 DoPinAppWithID(*pref_app_id); |
987 } | 1044 } |
988 | 1045 |
989 void ChromeLauncherControllerPerApp::SetShelfAutoHideBehaviorPrefs( | 1046 void ChromeLauncherControllerPerApp::SetShelfAutoHideBehaviorPrefs( |
990 ash::ShelfAutoHideBehavior behavior, | 1047 ash::ShelfAutoHideBehavior behavior, |
991 aura::RootWindow* root_window) { | 1048 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; | 1049 const char* value = NULL; |
997 switch (behavior) { | 1050 switch (behavior) { |
998 case ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS: | 1051 case ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS: |
999 value = ash::kShelfAutoHideBehaviorAlways; | 1052 value = ash::kShelfAutoHideBehaviorAlways; |
1000 break; | 1053 break; |
1001 case ash::SHELF_AUTO_HIDE_BEHAVIOR_NEVER: | 1054 case ash::SHELF_AUTO_HIDE_BEHAVIOR_NEVER: |
1002 value = ash::kShelfAutoHideBehaviorNever; | 1055 value = ash::kShelfAutoHideBehaviorNever; |
1003 break; | 1056 break; |
1004 } | 1057 } |
1005 // See comment in |kShelfAlignment| about why we have two prefs here. | 1058 |
1006 profile_->GetPrefs()->SetString(prefs::kShelfAutoHideBehaviorLocal, value); | 1059 UpdatePerDisplayPref( |
1007 profile_->GetPrefs()->SetString(prefs::kShelfAutoHideBehavior, value); | 1060 profile_->GetPrefs(), root_window, prefs::kShelfAutoHideBehavior, value); |
1061 | |
1062 if (root_window == ash::Shell::GetPrimaryRootWindow()) { | |
1063 // See comment in |kShelfAlignment| about why we have two prefs here. | |
1064 profile_->GetPrefs()->SetString(prefs::kShelfAutoHideBehaviorLocal, value); | |
1065 profile_->GetPrefs()->SetString(prefs::kShelfAutoHideBehavior, value); | |
1066 } | |
1008 } | 1067 } |
1009 | 1068 |
1010 void ChromeLauncherControllerPerApp::SetShelfAutoHideBehaviorFromPrefs() { | 1069 void ChromeLauncherControllerPerApp::SetShelfAutoHideBehaviorFromPrefs() { |
1011 // TODO(oshima): Support multiple displays. | 1070 ash::Shell::RootWindowList root_windows = ash::Shell::GetAllRootWindows(); |
1012 aura::RootWindow* root_window = ash::Shell::GetPrimaryRootWindow(); | 1071 for (ash::Shell::RootWindowList::const_iterator iter = root_windows.begin(); |
1013 ash::Shell::GetInstance()->SetShelfAutoHideBehavior( | 1072 iter != root_windows.end(); ++iter) { |
1014 GetShelfAutoHideBehavior(root_window), root_window); | 1073 ash::Shell::GetInstance()->SetShelfAutoHideBehavior( |
1074 GetShelfAutoHideBehavior(*iter), *iter); | |
1075 } | |
1015 } | 1076 } |
1016 | 1077 |
1017 void ChromeLauncherControllerPerApp::SetShelfAlignmentFromPrefs() { | 1078 void ChromeLauncherControllerPerApp::SetShelfAlignmentFromPrefs() { |
1018 if (!CommandLine::ForCurrentProcess()->HasSwitch( | 1079 if (!CommandLine::ForCurrentProcess()->HasSwitch( |
1019 switches::kShowLauncherAlignmentMenu)) | 1080 switches::kShowLauncherAlignmentMenu)) |
1020 return; | 1081 return; |
1021 | 1082 |
1022 // See comment in |kShelfAlignment| as to why we consider two prefs. | 1083 ash::Shell::RootWindowList root_windows = ash::Shell::GetAllRootWindows(); |
1023 const std::string alignment_value( | 1084 for (ash::Shell::RootWindowList::const_iterator iter = root_windows.begin(); |
1024 GetLocalOrRemotePref(profile_->GetPrefs(), | 1085 iter != root_windows.end(); ++iter) { |
1025 prefs::kShelfAlignmentLocal, | 1086 // See comment in |kShelfAlignment| as to why we consider two prefs. |
1026 prefs::kShelfAlignment)); | 1087 const std::string alignment_value( |
1027 ash::ShelfAlignment alignment = ash::SHELF_ALIGNMENT_BOTTOM; | 1088 GetPrefForRootWindow(profile_->GetPrefs(), |
1028 if (alignment_value == ash::kShelfAlignmentLeft) | 1089 *iter, |
1029 alignment = ash::SHELF_ALIGNMENT_LEFT; | 1090 prefs::kShelfAlignmentLocal, |
1030 else if (alignment_value == ash::kShelfAlignmentRight) | 1091 prefs::kShelfAlignment)); |
1031 alignment = ash::SHELF_ALIGNMENT_RIGHT; | 1092 ash::ShelfAlignment alignment = ash::SHELF_ALIGNMENT_BOTTOM; |
1032 // TODO(oshima): Support multiple displays. | 1093 if (alignment_value == ash::kShelfAlignmentLeft) |
1033 ash::Shell::GetInstance()->SetShelfAlignment( | 1094 alignment = ash::SHELF_ALIGNMENT_LEFT; |
1034 alignment, ash::Shell::GetPrimaryRootWindow()); | 1095 else if (alignment_value == ash::kShelfAlignmentRight) |
1096 alignment = ash::SHELF_ALIGNMENT_RIGHT; | |
1097 ash::Shell::GetInstance()->SetShelfAlignment(alignment, *iter); | |
1098 } | |
1035 } | 1099 } |
1036 | 1100 |
1037 WebContents* ChromeLauncherControllerPerApp::GetLastActiveWebContents( | 1101 WebContents* ChromeLauncherControllerPerApp::GetLastActiveWebContents( |
1038 const std::string& app_id) { | 1102 const std::string& app_id) { |
1039 AppIDToWebContentsListMap::const_iterator i = | 1103 AppIDToWebContentsListMap::const_iterator i = |
1040 app_id_to_web_contents_list_.find(app_id); | 1104 app_id_to_web_contents_list_.find(app_id); |
1041 if (i == app_id_to_web_contents_list_.end()) | 1105 if (i == app_id_to_web_contents_list_.end()) |
1042 return NULL; | 1106 return NULL; |
1043 DCHECK_GT(i->second.size(), 0u); | 1107 DCHECK_GT(i->second.size(), 0u); |
1044 return *i->second.begin(); | 1108 return *i->second.begin(); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1103 void ChromeLauncherControllerPerApp::SetAppIconLoaderForTest( | 1167 void ChromeLauncherControllerPerApp::SetAppIconLoaderForTest( |
1104 AppIconLoader* loader) { | 1168 AppIconLoader* loader) { |
1105 app_icon_loader_.reset(loader); | 1169 app_icon_loader_.reset(loader); |
1106 } | 1170 } |
1107 | 1171 |
1108 const std::string& | 1172 const std::string& |
1109 ChromeLauncherControllerPerApp::GetAppIdFromLauncherIdForTest( | 1173 ChromeLauncherControllerPerApp::GetAppIdFromLauncherIdForTest( |
1110 ash::LauncherID id) { | 1174 ash::LauncherID id) { |
1111 return id_to_item_controller_map_[id]->app_id(); | 1175 return id_to_item_controller_map_[id]->app_id(); |
1112 } | 1176 } |
OLD | NEW |