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

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: Rebase to master. 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 #if defined(OS_CHROMEOS)
450 SetVirtualKeyboardBehaviorFromPrefs();
451 #endif // defined(OS_CHROMEOS)
449 PrefServiceSyncable* prefs = PrefServiceSyncable::FromProfile(profile_); 452 PrefServiceSyncable* prefs = PrefServiceSyncable::FromProfile(profile_);
450 if (!prefs->FindPreference(prefs::kShelfAlignmentLocal)->HasUserSetting() || 453 if (!prefs->FindPreference(prefs::kShelfAlignmentLocal)->HasUserSetting() ||
451 !prefs->FindPreference(prefs::kShelfAutoHideBehaviorLocal)-> 454 !prefs->FindPreference(prefs::kShelfAutoHideBehaviorLocal)->
452 HasUserSetting()) { 455 HasUserSetting()) {
453 // This causes OnIsSyncingChanged to be called when the value of 456 // This causes OnIsSyncingChanged to be called when the value of
454 // PrefService::IsSyncing() changes. 457 // PrefService::IsSyncing() changes.
455 prefs->AddObserver(this); 458 prefs->AddObserver(this);
456 } 459 }
457 ash::Shell::GetInstance()->AddShellObserver(this); 460 ash::Shell::GetInstance()->AddShellObserver(this);
458 } 461 }
(...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after
1121 AttachProfile(ProfileManager::GetActiveUserProfile()); 1124 AttachProfile(ProfileManager::GetActiveUserProfile());
1122 // Update the V1 applications. 1125 // Update the V1 applications.
1123 browser_status_monitor_->ActiveUserChanged(user_email); 1126 browser_status_monitor_->ActiveUserChanged(user_email);
1124 // Switch the running applications to the new user. 1127 // Switch the running applications to the new user.
1125 app_window_controller_->ActiveUserChanged(user_email); 1128 app_window_controller_->ActiveUserChanged(user_email);
1126 // Update the user specific shell properties from the new user profile. 1129 // Update the user specific shell properties from the new user profile.
1127 UpdateAppLaunchersFromPref(); 1130 UpdateAppLaunchersFromPref();
1128 SetShelfAlignmentFromPrefs(); 1131 SetShelfAlignmentFromPrefs();
1129 SetShelfAutoHideBehaviorFromPrefs(); 1132 SetShelfAutoHideBehaviorFromPrefs();
1130 SetShelfBehaviorsFromPrefs(); 1133 SetShelfBehaviorsFromPrefs();
1134 #if defined(OS_CHROMEOS)
1135 SetVirtualKeyboardBehaviorFromPrefs();
1136 #endif // defined(OS_CHROMEOS)
1131 // Restore the order of running, but unpinned applications for the activated 1137 // Restore the order of running, but unpinned applications for the activated
1132 // user. 1138 // user.
1133 RestoreUnpinnedRunningApplicationOrder(user_email); 1139 RestoreUnpinnedRunningApplicationOrder(user_email);
1134 // Inform the system tray of the change. 1140 // Inform the system tray of the change.
1135 ash::Shell::GetInstance()->system_tray_delegate()->ActiveUserWasChanged(); 1141 ash::Shell::GetInstance()->system_tray_delegate()->ActiveUserWasChanged();
1136 // Force on-screen keyboard to reset. 1142 // Force on-screen keyboard to reset.
1137 if (keyboard::IsKeyboardEnabled()) 1143 if (keyboard::IsKeyboardEnabled())
1138 ash::Shell::GetInstance()->CreateKeyboard(); 1144 ash::Shell::GetInstance()->CreateKeyboard();
1139 } 1145 }
1140 1146
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after
1703 alignment = ash::SHELF_ALIGNMENT_TOP; 1709 alignment = ash::SHELF_ALIGNMENT_TOP;
1704 ash::Shell::GetInstance()->SetShelfAlignment(alignment, *iter); 1710 ash::Shell::GetInstance()->SetShelfAlignment(alignment, *iter);
1705 } 1711 }
1706 } 1712 }
1707 1713
1708 void ChromeLauncherController::SetShelfBehaviorsFromPrefs() { 1714 void ChromeLauncherController::SetShelfBehaviorsFromPrefs() {
1709 SetShelfAutoHideBehaviorFromPrefs(); 1715 SetShelfAutoHideBehaviorFromPrefs();
1710 SetShelfAlignmentFromPrefs(); 1716 SetShelfAlignmentFromPrefs();
1711 } 1717 }
1712 1718
1719 #if defined(OS_CHROMEOS)
1720 void ChromeLauncherController::SetVirtualKeyboardBehaviorFromPrefs() {
1721 const PrefService* service = profile_->GetPrefs();
1722 if (!service->HasPrefPath(prefs::kTouchVirtualKeyboardEnabled)) {
1723 keyboard::SetKeyboardShowOverride(keyboard::KEYBOARD_SHOW_OVERRIDE_NONE);
1724 } else {
1725 const bool enabled = service->GetBoolean(
1726 prefs::kTouchVirtualKeyboardEnabled);
1727 keyboard::SetKeyboardShowOverride(
1728 enabled ? keyboard::KEYBOARD_SHOW_OVERRIDE_ENABLED
1729 : keyboard::KEYBOARD_SHOW_OVERRIDE_DISABLED);
1730 }
1731 }
1732 #endif // defined(OS_CHROMEOS)
1733
1713 ash::ShelfItemStatus ChromeLauncherController::GetAppState( 1734 ash::ShelfItemStatus ChromeLauncherController::GetAppState(
1714 const::std::string& app_id) { 1735 const::std::string& app_id) {
1715 ash::ShelfItemStatus status = ash::STATUS_CLOSED; 1736 ash::ShelfItemStatus status = ash::STATUS_CLOSED;
1716 for (WebContentsToAppIDMap::iterator it = web_contents_to_app_id_.begin(); 1737 for (WebContentsToAppIDMap::iterator it = web_contents_to_app_id_.begin();
1717 it != web_contents_to_app_id_.end(); 1738 it != web_contents_to_app_id_.end();
1718 ++it) { 1739 ++it) {
1719 if (it->second == app_id) { 1740 if (it->second == app_id) {
1720 Browser* browser = chrome::FindBrowserWithWebContents(it->first); 1741 Browser* browser = chrome::FindBrowserWithWebContents(it->first);
1721 // Usually there should never be an item in our |web_contents_to_app_id_| 1742 // 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. 1743 // 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))); 2044 base::Unretained(this)));
2024 pref_change_registrar_.Add( 2045 pref_change_registrar_.Add(
2025 prefs::kShelfAutoHideBehaviorLocal, 2046 prefs::kShelfAutoHideBehaviorLocal,
2026 base::Bind(&ChromeLauncherController:: 2047 base::Bind(&ChromeLauncherController::
2027 SetShelfAutoHideBehaviorFromPrefs, 2048 SetShelfAutoHideBehaviorFromPrefs,
2028 base::Unretained(this))); 2049 base::Unretained(this)));
2029 pref_change_registrar_.Add( 2050 pref_change_registrar_.Add(
2030 prefs::kShelfPreferences, 2051 prefs::kShelfPreferences,
2031 base::Bind(&ChromeLauncherController::SetShelfBehaviorsFromPrefs, 2052 base::Bind(&ChromeLauncherController::SetShelfBehaviorsFromPrefs,
2032 base::Unretained(this))); 2053 base::Unretained(this)));
2054 #if defined(OS_CHROMEOS)
2055 pref_change_registrar_.Add(
2056 prefs::kTouchVirtualKeyboardEnabled,
2057 base::Bind(&ChromeLauncherController::SetVirtualKeyboardBehaviorFromPrefs,
2058 base::Unretained(this)));
2059 #endif // defined(OS_CHROMEOS)
2033 } 2060 }
2034 2061
2035 void ChromeLauncherController::ReleaseProfile() { 2062 void ChromeLauncherController::ReleaseProfile() {
2036 if (app_sync_ui_state_) 2063 if (app_sync_ui_state_)
2037 app_sync_ui_state_->RemoveObserver(this); 2064 app_sync_ui_state_->RemoveObserver(this);
2038 2065
2039 PrefServiceSyncable::FromProfile(profile_)->RemoveObserver(this); 2066 PrefServiceSyncable::FromProfile(profile_)->RemoveObserver(this);
2040 2067
2041 pref_change_registrar_.RemoveAll(); 2068 pref_change_registrar_.RemoveAll();
2042 } 2069 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698