Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(118)

Side by Side Diff: chrome/browser/ui/ash/launcher/chrome_launcher_controller.cc

Issue 320223002: Add device policy: Kiosk Virtual Keyboard Layout. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 } 439 }
440 440
441 void ChromeLauncherController::Init() { 441 void ChromeLauncherController::Init() {
442 CreateBrowserShortcutLauncherItem(); 442 CreateBrowserShortcutLauncherItem();
443 UpdateAppLaunchersFromPref(); 443 UpdateAppLaunchersFromPref();
444 444
445 // TODO(sky): update unit test so that this test isn't necessary. 445 // TODO(sky): update unit test so that this test isn't necessary.
446 if (ash::Shell::HasInstance()) { 446 if (ash::Shell::HasInstance()) {
447 SetShelfAutoHideBehaviorFromPrefs(); 447 SetShelfAutoHideBehaviorFromPrefs();
448 SetShelfAlignmentFromPrefs(); 448 SetShelfAlignmentFromPrefs();
449 SetVirtualKeyboardBehaviorFromPrefs();
449 PrefServiceSyncable* prefs = PrefServiceSyncable::FromProfile(profile_); 450 PrefServiceSyncable* prefs = PrefServiceSyncable::FromProfile(profile_);
450 if (!prefs->FindPreference(prefs::kShelfAlignmentLocal)->HasUserSetting() || 451 if (!prefs->FindPreference(prefs::kShelfAlignmentLocal)->HasUserSetting() ||
451 !prefs->FindPreference(prefs::kShelfAutoHideBehaviorLocal)-> 452 !prefs->FindPreference(prefs::kShelfAutoHideBehaviorLocal)->
452 HasUserSetting()) { 453 HasUserSetting()) {
453 // This causes OnIsSyncingChanged to be called when the value of 454 // This causes OnIsSyncingChanged to be called when the value of
454 // PrefService::IsSyncing() changes. 455 // PrefService::IsSyncing() changes.
455 prefs->AddObserver(this); 456 prefs->AddObserver(this);
456 } 457 }
457 ash::Shell::GetInstance()->AddShellObserver(this); 458 ash::Shell::GetInstance()->AddShellObserver(this);
458 } 459 }
(...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after
1121 AttachProfile(ProfileManager::GetActiveUserProfile()); 1122 AttachProfile(ProfileManager::GetActiveUserProfile());
1122 // Update the V1 applications. 1123 // Update the V1 applications.
1123 browser_status_monitor_->ActiveUserChanged(user_email); 1124 browser_status_monitor_->ActiveUserChanged(user_email);
1124 // Switch the running applications to the new user. 1125 // Switch the running applications to the new user.
1125 app_window_controller_->ActiveUserChanged(user_email); 1126 app_window_controller_->ActiveUserChanged(user_email);
1126 // Update the user specific shell properties from the new user profile. 1127 // Update the user specific shell properties from the new user profile.
1127 UpdateAppLaunchersFromPref(); 1128 UpdateAppLaunchersFromPref();
1128 SetShelfAlignmentFromPrefs(); 1129 SetShelfAlignmentFromPrefs();
1129 SetShelfAutoHideBehaviorFromPrefs(); 1130 SetShelfAutoHideBehaviorFromPrefs();
1130 SetShelfBehaviorsFromPrefs(); 1131 SetShelfBehaviorsFromPrefs();
1132 SetVirtualKeyboardBehaviorFromPrefs();
1131 // Restore the order of running, but unpinned applications for the activated 1133 // Restore the order of running, but unpinned applications for the activated
1132 // user. 1134 // user.
1133 RestoreUnpinnedRunningApplicationOrder(user_email); 1135 RestoreUnpinnedRunningApplicationOrder(user_email);
1134 // Inform the system tray of the change. 1136 // Inform the system tray of the change.
1135 ash::Shell::GetInstance()->system_tray_delegate()->ActiveUserWasChanged(); 1137 ash::Shell::GetInstance()->system_tray_delegate()->ActiveUserWasChanged();
1136 // Force on-screen keyboard to reset. 1138 // Force on-screen keyboard to reset.
1137 if (keyboard::IsKeyboardEnabled()) 1139 if (keyboard::IsKeyboardEnabled())
1138 ash::Shell::GetInstance()->CreateKeyboard(); 1140 ash::Shell::GetInstance()->CreateKeyboard();
1139 } 1141 }
1140 1142
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after
1703 alignment = ash::SHELF_ALIGNMENT_TOP; 1705 alignment = ash::SHELF_ALIGNMENT_TOP;
1704 ash::Shell::GetInstance()->SetShelfAlignment(alignment, *iter); 1706 ash::Shell::GetInstance()->SetShelfAlignment(alignment, *iter);
1705 } 1707 }
1706 } 1708 }
1707 1709
1708 void ChromeLauncherController::SetShelfBehaviorsFromPrefs() { 1710 void ChromeLauncherController::SetShelfBehaviorsFromPrefs() {
1709 SetShelfAutoHideBehaviorFromPrefs(); 1711 SetShelfAutoHideBehaviorFromPrefs();
1710 SetShelfAlignmentFromPrefs(); 1712 SetShelfAlignmentFromPrefs();
1711 } 1713 }
1712 1714
1715 void ChromeLauncherController::SetVirtualKeyboardBehaviorFromPrefs() {
1716 #if defined(OS_CHROMEOS)
bartfab (slow) 2014/06/16 10:20:13 Nit: Since this method does nothing on other platf
rsadam 2014/06/16 13:45:34 Done.
1717 PrefService* service = profile_->GetPrefs();
bartfab (slow) 2014/06/16 10:20:13 Nit: const.
rsadam 2014/06/16 13:45:34 Done.
1718 if (!service->HasPrefPath(prefs::kTouchVirtualKeyboardEnabled)) {
1719 keyboard::SetKeyboardShowOverride(keyboard::KEYBOARD_SHOW_OVERRIDE_NONE);
1720 } else {
1721 bool enabled = service->GetBoolean(prefs::kTouchVirtualKeyboardEnabled);
bartfab (slow) 2014/06/16 10:20:13 Nit: const.
rsadam 2014/06/16 13:45:34 Done.
1722 keyboard::SetKeyboardShowOverride(
1723 enabled ? keyboard::KEYBOARD_SHOW_OVERRIDE_ENABLED
1724 : keyboard::KEYBOARD_SHOW_OVERRIDE_DISABLED);
1725 }
1726 #endif // !OS_CHROMEOS
1727 }
1728
1713 ash::ShelfItemStatus ChromeLauncherController::GetAppState( 1729 ash::ShelfItemStatus ChromeLauncherController::GetAppState(
1714 const::std::string& app_id) { 1730 const::std::string& app_id) {
1715 ash::ShelfItemStatus status = ash::STATUS_CLOSED; 1731 ash::ShelfItemStatus status = ash::STATUS_CLOSED;
1716 for (WebContentsToAppIDMap::iterator it = web_contents_to_app_id_.begin(); 1732 for (WebContentsToAppIDMap::iterator it = web_contents_to_app_id_.begin();
1717 it != web_contents_to_app_id_.end(); 1733 it != web_contents_to_app_id_.end();
1718 ++it) { 1734 ++it) {
1719 if (it->second == app_id) { 1735 if (it->second == app_id) {
1720 Browser* browser = chrome::FindBrowserWithWebContents(it->first); 1736 Browser* browser = chrome::FindBrowserWithWebContents(it->first);
1721 // Usually there should never be an item in our |web_contents_to_app_id_| 1737 // Usually there should never be an item in our |web_contents_to_app_id_|
1722 // list which got deleted already. However - in some situations e.g. 1738 // list which got deleted already. However - in some situations e.g.
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
2023 base::Unretained(this))); 2039 base::Unretained(this)));
2024 pref_change_registrar_.Add( 2040 pref_change_registrar_.Add(
2025 prefs::kShelfAutoHideBehaviorLocal, 2041 prefs::kShelfAutoHideBehaviorLocal,
2026 base::Bind(&ChromeLauncherController:: 2042 base::Bind(&ChromeLauncherController::
2027 SetShelfAutoHideBehaviorFromPrefs, 2043 SetShelfAutoHideBehaviorFromPrefs,
2028 base::Unretained(this))); 2044 base::Unretained(this)));
2029 pref_change_registrar_.Add( 2045 pref_change_registrar_.Add(
2030 prefs::kShelfPreferences, 2046 prefs::kShelfPreferences,
2031 base::Bind(&ChromeLauncherController::SetShelfBehaviorsFromPrefs, 2047 base::Bind(&ChromeLauncherController::SetShelfBehaviorsFromPrefs,
2032 base::Unretained(this))); 2048 base::Unretained(this)));
2049 pref_change_registrar_.Add(
2050 prefs::kTouchVirtualKeyboardEnabled,
2051 base::Bind(&ChromeLauncherController::SetVirtualKeyboardBehaviorFromPrefs,
2052 base::Unretained(this)));
2033 } 2053 }
2034 2054
2035 void ChromeLauncherController::ReleaseProfile() { 2055 void ChromeLauncherController::ReleaseProfile() {
2036 if (app_sync_ui_state_) 2056 if (app_sync_ui_state_)
2037 app_sync_ui_state_->RemoveObserver(this); 2057 app_sync_ui_state_->RemoveObserver(this);
2038 2058
2039 PrefServiceSyncable::FromProfile(profile_)->RemoveObserver(this); 2059 PrefServiceSyncable::FromProfile(profile_)->RemoveObserver(this);
2040 2060
2041 pref_change_registrar_.RemoveAll(); 2061 pref_change_registrar_.RemoveAll();
2042 } 2062 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698