Home | History | Annotate | Download | only in tray
      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
      3 // found in the LICENSE file.
      4 
      5 #include "ash/system/tray/test_system_tray_delegate.h"
      6 
      7 #include <string>
      8 
      9 #include "ash/session_state_delegate.h"
     10 #include "ash/shell.h"
     11 #include "ash/volume_control_delegate.h"
     12 #include "base/message_loop/message_loop.h"
     13 #include "base/time/time.h"
     14 
     15 namespace ash {
     16 namespace test {
     17 
     18 namespace {
     19 
     20 class TestVolumeControlDelegate : public VolumeControlDelegate {
     21  public:
     22   TestVolumeControlDelegate() {}
     23   virtual ~TestVolumeControlDelegate() {}
     24 
     25   virtual bool HandleVolumeMute(const ui::Accelerator& accelerator) OVERRIDE {
     26     return true;
     27   }
     28   virtual bool HandleVolumeDown(const ui::Accelerator& accelerator) OVERRIDE {
     29     return true;
     30   }
     31   virtual bool HandleVolumeUp(const ui::Accelerator& accelerator) OVERRIDE {
     32     return true;
     33   }
     34 
     35  private:
     36   DISALLOW_COPY_AND_ASSIGN(TestVolumeControlDelegate);
     37 };
     38 
     39 }  // namespace
     40 
     41 TestSystemTrayDelegate::TestSystemTrayDelegate()
     42     : bluetooth_enabled_(true),
     43       caps_lock_enabled_(false),
     44       should_show_display_notification_(false),
     45       volume_control_delegate_(new TestVolumeControlDelegate) {
     46 }
     47 
     48 TestSystemTrayDelegate::~TestSystemTrayDelegate() {
     49 }
     50 
     51 void TestSystemTrayDelegate::Initialize() {
     52 }
     53 
     54 void TestSystemTrayDelegate::Shutdown() {
     55 }
     56 
     57 bool TestSystemTrayDelegate::GetTrayVisibilityOnStartup() {
     58   return true;
     59 }
     60 
     61 // Overridden from SystemTrayDelegate:
     62 user::LoginStatus TestSystemTrayDelegate::GetUserLoginStatus() const {
     63   // At new user image screen manager->IsUserLoggedIn() would return true
     64   // but there's no browser session available yet so use SessionStarted().
     65   SessionStateDelegate* delegate =
     66       Shell::GetInstance()->session_state_delegate();
     67 
     68   if (!delegate->IsActiveUserSessionStarted())
     69     return ash::user::LOGGED_IN_NONE;
     70   if (delegate->IsScreenLocked())
     71     return user::LOGGED_IN_LOCKED;
     72   // TODO(nkostylev): Support LOGGED_IN_OWNER, LOGGED_IN_GUEST, LOGGED_IN_KIOSK,
     73   //                  LOGGED_IN_PUBLIC.
     74   return user::LOGGED_IN_USER;
     75 }
     76 
     77 bool TestSystemTrayDelegate::IsOobeCompleted() const {
     78   return true;
     79 }
     80 
     81 void TestSystemTrayDelegate::ChangeProfilePicture() {
     82 }
     83 
     84 const std::string TestSystemTrayDelegate::GetEnterpriseDomain() const {
     85   return std::string();
     86 }
     87 
     88 const base::string16 TestSystemTrayDelegate::GetEnterpriseMessage() const {
     89   return string16();
     90 }
     91 
     92 const std::string TestSystemTrayDelegate::GetLocallyManagedUserManager() const {
     93   return std::string();
     94 }
     95 
     96 const base::string16 TestSystemTrayDelegate::GetLocallyManagedUserManagerName()
     97     const {
     98   return string16();
     99 }
    100 
    101 const base::string16 TestSystemTrayDelegate::GetLocallyManagedUserMessage()
    102     const {
    103   return string16();
    104 }
    105 
    106 bool TestSystemTrayDelegate::SystemShouldUpgrade() const {
    107   return true;
    108 }
    109 
    110 base::HourClockType TestSystemTrayDelegate::GetHourClockType() const {
    111   return base::k24HourClock;
    112 }
    113 
    114 void TestSystemTrayDelegate::ShowSettings() {
    115 }
    116 
    117 bool TestSystemTrayDelegate::ShouldShowSettings() {
    118   return true;
    119 }
    120 
    121 void TestSystemTrayDelegate::ShowDateSettings() {
    122 }
    123 
    124 void TestSystemTrayDelegate::ShowNetworkSettings(
    125     const std::string& service_path) {
    126 }
    127 
    128 void TestSystemTrayDelegate::ShowBluetoothSettings() {
    129 }
    130 
    131 void TestSystemTrayDelegate::ShowDisplaySettings() {
    132 }
    133 
    134 void TestSystemTrayDelegate::ShowChromeSlow() {
    135 }
    136 
    137 bool TestSystemTrayDelegate::ShouldShowDisplayNotification() {
    138   return should_show_display_notification_;
    139 }
    140 
    141 void TestSystemTrayDelegate::ShowDriveSettings() {
    142 }
    143 
    144 void TestSystemTrayDelegate::ShowIMESettings() {
    145 }
    146 
    147 void TestSystemTrayDelegate::ShowHelp() {
    148 }
    149 
    150 void TestSystemTrayDelegate::ShowAccessibilityHelp() {
    151 }
    152 
    153 void TestSystemTrayDelegate::ShowAccessibilitySettings() {
    154 }
    155 
    156 void TestSystemTrayDelegate::ShowPublicAccountInfo() {
    157 }
    158 
    159 void TestSystemTrayDelegate::ShowEnterpriseInfo() {
    160 }
    161 
    162 void TestSystemTrayDelegate::ShowLocallyManagedUserInfo() {
    163 }
    164 
    165 void TestSystemTrayDelegate::ShowUserLogin() {
    166 }
    167 
    168 void TestSystemTrayDelegate::ShutDown() {
    169   base::MessageLoop::current()->Quit();
    170 }
    171 
    172 void TestSystemTrayDelegate::SignOut() {
    173   base::MessageLoop::current()->Quit();
    174 }
    175 
    176 void TestSystemTrayDelegate::RequestLockScreen() {
    177 }
    178 
    179 void TestSystemTrayDelegate::RequestRestartForUpdate() {
    180 }
    181 
    182 void TestSystemTrayDelegate::GetAvailableBluetoothDevices(
    183     BluetoothDeviceList* list) {
    184 }
    185 
    186 void TestSystemTrayDelegate::BluetoothStartDiscovering() {
    187 }
    188 
    189 void TestSystemTrayDelegate::BluetoothStopDiscovering() {
    190 }
    191 
    192 void TestSystemTrayDelegate::ConnectToBluetoothDevice(
    193     const std::string& address) {
    194 }
    195 
    196 void TestSystemTrayDelegate::GetCurrentIME(IMEInfo* info) {
    197 }
    198 
    199 void TestSystemTrayDelegate::GetAvailableIMEList(IMEInfoList* list) {
    200 }
    201 
    202 void TestSystemTrayDelegate::GetCurrentIMEProperties(
    203     IMEPropertyInfoList* list) {
    204 }
    205 
    206 void TestSystemTrayDelegate::SwitchIME(const std::string& ime_id) {
    207 }
    208 
    209 void TestSystemTrayDelegate::ActivateIMEProperty(const std::string& key) {
    210 }
    211 
    212 void TestSystemTrayDelegate::CancelDriveOperation(int32 operation_id) {
    213 }
    214 
    215 void TestSystemTrayDelegate::GetDriveOperationStatusList(
    216     ash::DriveOperationStatusList*) {
    217 }
    218 
    219 void TestSystemTrayDelegate::ConfigureNetwork(const std::string& network_id) {
    220 }
    221 
    222 void TestSystemTrayDelegate::EnrollOrConfigureNetwork(
    223     const std::string& network_id,
    224     gfx::NativeWindow parent_window) {
    225 }
    226 
    227 void TestSystemTrayDelegate::ManageBluetoothDevices() {
    228 }
    229 
    230 void TestSystemTrayDelegate::ToggleBluetooth() {
    231   bluetooth_enabled_ = !bluetooth_enabled_;
    232 }
    233 
    234 bool TestSystemTrayDelegate::IsBluetoothDiscovering() {
    235   return false;
    236 }
    237 
    238 void TestSystemTrayDelegate::ShowMobileSimDialog() {
    239 }
    240 
    241 void TestSystemTrayDelegate::ShowMobileSetup(const std::string& network_id) {
    242 }
    243 
    244 void TestSystemTrayDelegate::ShowOtherWifi() {
    245 }
    246 
    247 void TestSystemTrayDelegate::ShowOtherVPN() {
    248 }
    249 
    250 void TestSystemTrayDelegate::ShowOtherCellular() {
    251 }
    252 
    253 bool TestSystemTrayDelegate::GetBluetoothAvailable() {
    254   return true;
    255 }
    256 
    257 bool TestSystemTrayDelegate::GetBluetoothEnabled() {
    258   return bluetooth_enabled_;
    259 }
    260 
    261 bool TestSystemTrayDelegate::GetCellularCarrierInfo(std::string* carrier_id,
    262                                                     std::string* topup_url,
    263                                                     std::string* setup_url) {
    264   return false;
    265 }
    266 
    267 void TestSystemTrayDelegate::ShowCellularURL(const std::string& url) {
    268 }
    269 
    270 void TestSystemTrayDelegate::ChangeProxySettings() {
    271 }
    272 
    273 VolumeControlDelegate* TestSystemTrayDelegate::GetVolumeControlDelegate()
    274     const {
    275   return volume_control_delegate_.get();
    276 }
    277 
    278 void TestSystemTrayDelegate::SetVolumeControlDelegate(
    279     scoped_ptr<VolumeControlDelegate> delegate) {
    280   volume_control_delegate_ = delegate.Pass();
    281 }
    282 
    283 bool TestSystemTrayDelegate::GetSessionStartTime(
    284     base::TimeTicks* session_start_time) {
    285   return false;
    286 }
    287 
    288 bool TestSystemTrayDelegate::GetSessionLengthLimit(
    289      base::TimeDelta* session_length_limit) {
    290   return false;
    291 }
    292 
    293 int TestSystemTrayDelegate::GetSystemTrayMenuWidth() {
    294   // This is the default width for English languages.
    295   return 300;
    296 }
    297 
    298 base::string16 TestSystemTrayDelegate::FormatTimeDuration(
    299     const base::TimeDelta& delta) const {
    300   return base::string16();
    301 }
    302 
    303 void TestSystemTrayDelegate::MaybeSpeak(const std::string& utterance) const {
    304 }
    305 
    306 }  // namespace test
    307 }  // namespace ash
    308