| 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 return value; |
| 128 } | 184 } |
| 129 | 185 |
| 130 // If prefs have synced and no user-set value exists at |local_path|, the value | 186 // If prefs have synced and no user-set value exists at |local_path|, the value |
| 131 // from |synced_path| is copied to |local_path|. | 187 // from |synced_path| is copied to |local_path|. |
| 132 void MaybePropagatePrefToLocal(PrefService* pref_service, | 188 void MaybePropagatePrefToLocal(PrefService* pref_service, |
| 133 const char* local_path, | 189 const char* local_path, |
| 134 const char* synced_path) { | 190 const char* synced_path) { |
| 135 if (!pref_service->FindPreference(local_path)->HasUserSetting() && | 191 if (!pref_service->FindPreference(local_path)->HasUserSetting() && |
| 136 pref_service->IsSyncing()) { | 192 pref_service->IsSyncing()) { |
| 137 // First time the user is using this machine, propagate from remote to | 193 // 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 | 612 |
| 557 bool ChromeLauncherControllerPerApp::CanPin() const { | 613 bool ChromeLauncherControllerPerApp::CanPin() const { |
| 558 const PrefService::Preference* pref = | 614 const PrefService::Preference* pref = |
| 559 profile_->GetPrefs()->FindPreference(prefs::kPinnedLauncherApps); | 615 profile_->GetPrefs()->FindPreference(prefs::kPinnedLauncherApps); |
| 560 return pref && pref->IsUserModifiable(); | 616 return pref && pref->IsUserModifiable(); |
| 561 } | 617 } |
| 562 | 618 |
| 563 ash::ShelfAutoHideBehavior | 619 ash::ShelfAutoHideBehavior |
| 564 ChromeLauncherControllerPerApp::GetShelfAutoHideBehavior( | 620 ChromeLauncherControllerPerApp::GetShelfAutoHideBehavior( |
| 565 aura::RootWindow* root_window) const { | 621 aura::RootWindow* root_window) const { |
| 566 // TODO(oshima): Support multiple launchers. | |
| 567 | |
| 568 // See comment in |kShelfAlignment| as to why we consider two prefs. | 622 // See comment in |kShelfAlignment| as to why we consider two prefs. |
| 569 const std::string behavior_value( | 623 const std::string behavior_value( |
| 570 GetLocalOrRemotePref(profile_->GetPrefs(), | 624 GetPrefForRootWindow(profile_->GetPrefs(), |
| 625 root_window, |
| 571 prefs::kShelfAutoHideBehaviorLocal, | 626 prefs::kShelfAutoHideBehaviorLocal, |
| 572 prefs::kShelfAutoHideBehavior)); | 627 prefs::kShelfAutoHideBehavior)); |
| 573 | 628 |
| 574 // Note: To maintain sync compatibility with old images of chrome/chromeos | 629 // Note: To maintain sync compatibility with old images of chrome/chromeos |
| 575 // the set of values that may be encountered includes the now-extinct | 630 // the set of values that may be encountered includes the now-extinct |
| 576 // "Default" as well as "Never" and "Always", "Default" should now | 631 // "Default" as well as "Never" and "Always", "Default" should now |
| 577 // be treated as "Never" (http://crbug.com/146773). | 632 // be treated as "Never" (http://crbug.com/146773). |
| 578 if (behavior_value == ash::kShelfAutoHideBehaviorAlways) | 633 if (behavior_value == ash::kShelfAutoHideBehaviorAlways) |
| 579 return ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS; | 634 return ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS; |
| 580 return ash::SHELF_AUTO_HIDE_BEHAVIOR_NEVER; | 635 return ash::SHELF_AUTO_HIDE_BEHAVIOR_NEVER; |
| 581 } | 636 } |
| 582 | 637 |
| 583 bool ChromeLauncherControllerPerApp::CanUserModifyShelfAutoHideBehavior( | 638 bool ChromeLauncherControllerPerApp::CanUserModifyShelfAutoHideBehavior( |
| 584 aura::RootWindow* root_window) const { | 639 aura::RootWindow* root_window) const { |
| 585 // TODO(oshima): Support multiple launchers. | |
| 586 return profile_->GetPrefs()-> | 640 return profile_->GetPrefs()-> |
| 587 FindPreference(prefs::kShelfAutoHideBehaviorLocal)->IsUserModifiable(); | 641 FindPreference(prefs::kShelfAutoHideBehaviorLocal)->IsUserModifiable(); |
| 588 } | 642 } |
| 589 | 643 |
| 590 void ChromeLauncherControllerPerApp::ToggleShelfAutoHideBehavior( | 644 void ChromeLauncherControllerPerApp::ToggleShelfAutoHideBehavior( |
| 591 aura::RootWindow* root_window) { | 645 aura::RootWindow* root_window) { |
| 592 ash::ShelfAutoHideBehavior behavior = GetShelfAutoHideBehavior(root_window) == | 646 ash::ShelfAutoHideBehavior behavior = GetShelfAutoHideBehavior(root_window) == |
| 593 ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS ? | 647 ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS ? |
| 594 ash::SHELF_AUTO_HIDE_BEHAVIOR_NEVER : | 648 ash::SHELF_AUTO_HIDE_BEHAVIOR_NEVER : |
| 595 ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS; | 649 ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS; |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 790 if (IsAppPinned(extension->id())) | 844 if (IsAppPinned(extension->id())) |
| 791 DoUnpinAppsWithID(extension->id()); | 845 DoUnpinAppsWithID(extension->id()); |
| 792 app_icon_loader_->ClearImage(extension->id()); | 846 app_icon_loader_->ClearImage(extension->id()); |
| 793 break; | 847 break; |
| 794 } | 848 } |
| 795 default: | 849 default: |
| 796 NOTREACHED() << "Unexpected notification type=" << type; | 850 NOTREACHED() << "Unexpected notification type=" << type; |
| 797 } | 851 } |
| 798 } | 852 } |
| 799 | 853 |
| 800 void ChromeLauncherControllerPerApp::OnShelfAlignmentChanged() { | 854 void ChromeLauncherControllerPerApp::OnShelfAlignmentChanged( |
| 855 aura::RootWindow* root_window) { |
| 801 const char* pref_value = NULL; | 856 const char* pref_value = NULL; |
| 802 // TODO(oshima): Support multiple displays. | 857 switch (ash::Shell::GetInstance()->GetShelfAlignment(root_window)) { |
| 803 switch (ash::Shell::GetInstance()->GetShelfAlignment( | |
| 804 ash::Shell::GetPrimaryRootWindow())) { | |
| 805 case ash::SHELF_ALIGNMENT_BOTTOM: | 858 case ash::SHELF_ALIGNMENT_BOTTOM: |
| 806 pref_value = ash::kShelfAlignmentBottom; | 859 pref_value = ash::kShelfAlignmentBottom; |
| 807 break; | 860 break; |
| 808 case ash::SHELF_ALIGNMENT_LEFT: | 861 case ash::SHELF_ALIGNMENT_LEFT: |
| 809 pref_value = ash::kShelfAlignmentLeft; | 862 pref_value = ash::kShelfAlignmentLeft; |
| 810 break; | 863 break; |
| 811 case ash::SHELF_ALIGNMENT_RIGHT: | 864 case ash::SHELF_ALIGNMENT_RIGHT: |
| 812 pref_value = ash::kShelfAlignmentRight; | 865 pref_value = ash::kShelfAlignmentRight; |
| 813 break; | 866 break; |
| 814 } | 867 } |
| 815 // See comment in |kShelfAlignment| about why we have two prefs here. | 868 |
| 816 profile_->GetPrefs()->SetString(prefs::kShelfAlignmentLocal, pref_value); | 869 UpdatePerDisplayPref( |
| 817 profile_->GetPrefs()->SetString(prefs::kShelfAlignment, pref_value); | 870 profile_->GetPrefs(), root_window, prefs::kShelfAlignment, pref_value); |
| 871 |
| 872 if (root_window == ash::Shell::GetPrimaryRootWindow()) { |
| 873 // See comment in |kShelfAlignment| about why we have two prefs here. |
| 874 profile_->GetPrefs()->SetString(prefs::kShelfAlignmentLocal, pref_value); |
| 875 profile_->GetPrefs()->SetString(prefs::kShelfAlignment, pref_value); |
| 876 } |
| 818 } | 877 } |
| 819 | 878 |
| 820 void ChromeLauncherControllerPerApp::OnIsSyncingChanged() { | 879 void ChromeLauncherControllerPerApp::OnIsSyncingChanged() { |
| 821 MaybePropagatePrefToLocal(profile_->GetPrefs(), | 880 MaybePropagatePrefToLocal(profile_->GetPrefs(), |
| 822 prefs::kShelfAlignmentLocal, | 881 prefs::kShelfAlignmentLocal, |
| 823 prefs::kShelfAlignment); | 882 prefs::kShelfAlignment); |
| 824 MaybePropagatePrefToLocal(profile_->GetPrefs(), | 883 MaybePropagatePrefToLocal(profile_->GetPrefs(), |
| 825 prefs::kShelfAutoHideBehaviorLocal, | 884 prefs::kShelfAutoHideBehaviorLocal, |
| 826 prefs::kShelfAutoHideBehavior); | 885 prefs::kShelfAutoHideBehavior); |
| 827 } | 886 } |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 982 } | 1041 } |
| 983 | 1042 |
| 984 // Append unprocessed items from the pref to the end of the model. | 1043 // Append unprocessed items from the pref to the end of the model. |
| 985 for (; pref_app_id != pinned_apps.end(); ++pref_app_id) | 1044 for (; pref_app_id != pinned_apps.end(); ++pref_app_id) |
| 986 DoPinAppWithID(*pref_app_id); | 1045 DoPinAppWithID(*pref_app_id); |
| 987 } | 1046 } |
| 988 | 1047 |
| 989 void ChromeLauncherControllerPerApp::SetShelfAutoHideBehaviorPrefs( | 1048 void ChromeLauncherControllerPerApp::SetShelfAutoHideBehaviorPrefs( |
| 990 ash::ShelfAutoHideBehavior behavior, | 1049 ash::ShelfAutoHideBehavior behavior, |
| 991 aura::RootWindow* root_window) { | 1050 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; | 1051 const char* value = NULL; |
| 997 switch (behavior) { | 1052 switch (behavior) { |
| 998 case ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS: | 1053 case ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS: |
| 999 value = ash::kShelfAutoHideBehaviorAlways; | 1054 value = ash::kShelfAutoHideBehaviorAlways; |
| 1000 break; | 1055 break; |
| 1001 case ash::SHELF_AUTO_HIDE_BEHAVIOR_NEVER: | 1056 case ash::SHELF_AUTO_HIDE_BEHAVIOR_NEVER: |
| 1002 value = ash::kShelfAutoHideBehaviorNever; | 1057 value = ash::kShelfAutoHideBehaviorNever; |
| 1003 break; | 1058 break; |
| 1004 } | 1059 } |
| 1005 // See comment in |kShelfAlignment| about why we have two prefs here. | 1060 |
| 1006 profile_->GetPrefs()->SetString(prefs::kShelfAutoHideBehaviorLocal, value); | 1061 UpdatePerDisplayPref( |
| 1007 profile_->GetPrefs()->SetString(prefs::kShelfAutoHideBehavior, value); | 1062 profile_->GetPrefs(), root_window, prefs::kShelfAutoHideBehavior, value); |
| 1063 |
| 1064 if (root_window == ash::Shell::GetPrimaryRootWindow()) { |
| 1065 // See comment in |kShelfAlignment| about why we have two prefs here. |
| 1066 profile_->GetPrefs()->SetString(prefs::kShelfAutoHideBehaviorLocal, value); |
| 1067 profile_->GetPrefs()->SetString(prefs::kShelfAutoHideBehavior, value); |
| 1068 } |
| 1008 } | 1069 } |
| 1009 | 1070 |
| 1010 void ChromeLauncherControllerPerApp::SetShelfAutoHideBehaviorFromPrefs() { | 1071 void ChromeLauncherControllerPerApp::SetShelfAutoHideBehaviorFromPrefs() { |
| 1011 // TODO(oshima): Support multiple displays. | 1072 ash::Shell::RootWindowList root_windows = ash::Shell::GetAllRootWindows(); |
| 1012 aura::RootWindow* root_window = ash::Shell::GetPrimaryRootWindow(); | 1073 for (ash::Shell::RootWindowList::const_iterator iter = root_windows.begin(); |
| 1013 ash::Shell::GetInstance()->SetShelfAutoHideBehavior( | 1074 iter != root_windows.end(); ++iter) { |
| 1014 GetShelfAutoHideBehavior(root_window), root_window); | 1075 ash::Shell::GetInstance()->SetShelfAutoHideBehavior( |
| 1076 GetShelfAutoHideBehavior(*iter), *iter); |
| 1077 } |
| 1015 } | 1078 } |
| 1016 | 1079 |
| 1017 void ChromeLauncherControllerPerApp::SetShelfAlignmentFromPrefs() { | 1080 void ChromeLauncherControllerPerApp::SetShelfAlignmentFromPrefs() { |
| 1018 if (!CommandLine::ForCurrentProcess()->HasSwitch( | 1081 if (!CommandLine::ForCurrentProcess()->HasSwitch( |
| 1019 switches::kShowLauncherAlignmentMenu)) | 1082 switches::kShowLauncherAlignmentMenu)) |
| 1020 return; | 1083 return; |
| 1021 | 1084 |
| 1022 // See comment in |kShelfAlignment| as to why we consider two prefs. | 1085 ash::Shell::RootWindowList root_windows = ash::Shell::GetAllRootWindows(); |
| 1023 const std::string alignment_value( | 1086 for (ash::Shell::RootWindowList::const_iterator iter = root_windows.begin(); |
| 1024 GetLocalOrRemotePref(profile_->GetPrefs(), | 1087 iter != root_windows.end(); ++iter) { |
| 1025 prefs::kShelfAlignmentLocal, | 1088 // See comment in |kShelfAlignment| as to why we consider two prefs. |
| 1026 prefs::kShelfAlignment)); | 1089 const std::string alignment_value( |
| 1027 ash::ShelfAlignment alignment = ash::SHELF_ALIGNMENT_BOTTOM; | 1090 GetPrefForRootWindow(profile_->GetPrefs(), |
| 1028 if (alignment_value == ash::kShelfAlignmentLeft) | 1091 *iter, |
| 1029 alignment = ash::SHELF_ALIGNMENT_LEFT; | 1092 prefs::kShelfAlignmentLocal, |
| 1030 else if (alignment_value == ash::kShelfAlignmentRight) | 1093 prefs::kShelfAlignment)); |
| 1031 alignment = ash::SHELF_ALIGNMENT_RIGHT; | 1094 ash::ShelfAlignment alignment = ash::SHELF_ALIGNMENT_BOTTOM; |
| 1032 // TODO(oshima): Support multiple displays. | 1095 if (alignment_value == ash::kShelfAlignmentLeft) |
| 1033 ash::Shell::GetInstance()->SetShelfAlignment( | 1096 alignment = ash::SHELF_ALIGNMENT_LEFT; |
| 1034 alignment, ash::Shell::GetPrimaryRootWindow()); | 1097 else if (alignment_value == ash::kShelfAlignmentRight) |
| 1098 alignment = ash::SHELF_ALIGNMENT_RIGHT; |
| 1099 ash::Shell::GetInstance()->SetShelfAlignment(alignment, *iter); |
| 1100 } |
| 1035 } | 1101 } |
| 1036 | 1102 |
| 1037 WebContents* ChromeLauncherControllerPerApp::GetLastActiveWebContents( | 1103 WebContents* ChromeLauncherControllerPerApp::GetLastActiveWebContents( |
| 1038 const std::string& app_id) { | 1104 const std::string& app_id) { |
| 1039 AppIDToWebContentsListMap::const_iterator i = | 1105 AppIDToWebContentsListMap::const_iterator i = |
| 1040 app_id_to_web_contents_list_.find(app_id); | 1106 app_id_to_web_contents_list_.find(app_id); |
| 1041 if (i == app_id_to_web_contents_list_.end()) | 1107 if (i == app_id_to_web_contents_list_.end()) |
| 1042 return NULL; | 1108 return NULL; |
| 1043 DCHECK_GT(i->second.size(), 0u); | 1109 DCHECK_GT(i->second.size(), 0u); |
| 1044 return *i->second.begin(); | 1110 return *i->second.begin(); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1103 void ChromeLauncherControllerPerApp::SetAppIconLoaderForTest( | 1169 void ChromeLauncherControllerPerApp::SetAppIconLoaderForTest( |
| 1104 AppIconLoader* loader) { | 1170 AppIconLoader* loader) { |
| 1105 app_icon_loader_.reset(loader); | 1171 app_icon_loader_.reset(loader); |
| 1106 } | 1172 } |
| 1107 | 1173 |
| 1108 const std::string& | 1174 const std::string& |
| 1109 ChromeLauncherControllerPerApp::GetAppIdFromLauncherIdForTest( | 1175 ChromeLauncherControllerPerApp::GetAppIdFromLauncherIdForTest( |
| 1110 ash::LauncherID id) { | 1176 ash::LauncherID id) { |
| 1111 return id_to_item_controller_map_[id]->app_id(); | 1177 return id_to_item_controller_map_[id]->app_id(); |
| 1112 } | 1178 } |
| OLD | NEW |