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

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: Attempt # 2 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 PrefService* service = profile_->GetPrefs();
1717 if (!service->HasPrefPath(prefs::kVirtualKeyboardEnabled)) {
bartfab (slow) 2014/06/13 12:15:53 Rather than checking whether the pref exists, just
rsadam 2014/06/13 15:28:46 Won't we need this check even if we ifdef? For exa
1718 keyboard::SetKeyboardShowOverride(keyboard::KEYBOARD_SHOW_OVERRIDE_NONE);
bartfab (slow) 2014/06/13 12:15:53 This does not look right to me: You take a per-pro
rsadam 2014/06/13 15:28:46 I believe that this would follow the profile setti
1719 } else {
1720 bool enabled = service->GetBoolean(prefs::kVirtualKeyboardEnabled);
1721 keyboard::SetKeyboardShowOverride(
1722 enabled ? keyboard::KEYBOARD_SHOW_OVERRIDE_ENABLED
1723 : keyboard::KEYBOARD_SHOW_OVERRIDE_DISABLED);
1724 }
1725 }
1726
1713 ash::ShelfItemStatus ChromeLauncherController::GetAppState( 1727 ash::ShelfItemStatus ChromeLauncherController::GetAppState(
1714 const::std::string& app_id) { 1728 const::std::string& app_id) {
1715 ash::ShelfItemStatus status = ash::STATUS_CLOSED; 1729 ash::ShelfItemStatus status = ash::STATUS_CLOSED;
1716 for (WebContentsToAppIDMap::iterator it = web_contents_to_app_id_.begin(); 1730 for (WebContentsToAppIDMap::iterator it = web_contents_to_app_id_.begin();
1717 it != web_contents_to_app_id_.end(); 1731 it != web_contents_to_app_id_.end();
1718 ++it) { 1732 ++it) {
1719 if (it->second == app_id) { 1733 if (it->second == app_id) {
1720 Browser* browser = chrome::FindBrowserWithWebContents(it->first); 1734 Browser* browser = chrome::FindBrowserWithWebContents(it->first);
1721 // Usually there should never be an item in our |web_contents_to_app_id_| 1735 // 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. 1736 // 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))); 2037 base::Unretained(this)));
2024 pref_change_registrar_.Add( 2038 pref_change_registrar_.Add(
2025 prefs::kShelfAutoHideBehaviorLocal, 2039 prefs::kShelfAutoHideBehaviorLocal,
2026 base::Bind(&ChromeLauncherController:: 2040 base::Bind(&ChromeLauncherController::
2027 SetShelfAutoHideBehaviorFromPrefs, 2041 SetShelfAutoHideBehaviorFromPrefs,
2028 base::Unretained(this))); 2042 base::Unretained(this)));
2029 pref_change_registrar_.Add( 2043 pref_change_registrar_.Add(
2030 prefs::kShelfPreferences, 2044 prefs::kShelfPreferences,
2031 base::Bind(&ChromeLauncherController::SetShelfBehaviorsFromPrefs, 2045 base::Bind(&ChromeLauncherController::SetShelfBehaviorsFromPrefs,
2032 base::Unretained(this))); 2046 base::Unretained(this)));
2047 pref_change_registrar_.Add(
2048 prefs::kVirtualKeyboardEnabled,
2049 base::Bind(&ChromeLauncherController::SetVirtualKeyboardBehaviorFromPrefs,
2050 base::Unretained(this)));
2033 } 2051 }
2034 2052
2035 void ChromeLauncherController::ReleaseProfile() { 2053 void ChromeLauncherController::ReleaseProfile() {
2036 if (app_sync_ui_state_) 2054 if (app_sync_ui_state_)
2037 app_sync_ui_state_->RemoveObserver(this); 2055 app_sync_ui_state_->RemoveObserver(this);
2038 2056
2039 PrefServiceSyncable::FromProfile(profile_)->RemoveObserver(this); 2057 PrefServiceSyncable::FromProfile(profile_)->RemoveObserver(this);
2040 2058
2041 pref_change_registrar_.RemoveAll(); 2059 pref_change_registrar_.RemoveAll();
2042 } 2060 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698