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

Side by Side Diff: chrome/browser/ui/ash/system_tray_delegate_chromeos.cc

Issue 2396863004: chromeos: Refactor system tray ShowNetworkSettingsForGuid for mash (Closed)
Patch Set: Created 4 years, 2 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
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/system_tray_delegate_chromeos.h" 5 #include "chrome/browser/ui/ash/system_tray_delegate_chromeos.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <set> 10 #include <set>
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 #include "components/user_manager/user.h" 99 #include "components/user_manager/user.h"
100 #include "components/user_manager/user_manager.h" 100 #include "components/user_manager/user_manager.h"
101 #include "components/user_manager/user_type.h" 101 #include "components/user_manager/user_type.h"
102 #include "content/public/browser/notification_observer.h" 102 #include "content/public/browser/notification_observer.h"
103 #include "content/public/browser/notification_service.h" 103 #include "content/public/browser/notification_service.h"
104 #include "content/public/browser/user_metrics.h" 104 #include "content/public/browser/user_metrics.h"
105 #include "content/public/browser/web_contents.h" 105 #include "content/public/browser/web_contents.h"
106 #include "device/bluetooth/bluetooth_adapter.h" 106 #include "device/bluetooth/bluetooth_adapter.h"
107 #include "device/bluetooth/bluetooth_adapter_factory.h" 107 #include "device/bluetooth/bluetooth_adapter_factory.h"
108 #include "device/bluetooth/bluetooth_device.h" 108 #include "device/bluetooth/bluetooth_device.h"
109 #include "net/base/escape.h"
110 #include "third_party/cros_system_api/dbus/service_constants.h" 109 #include "third_party/cros_system_api/dbus/service_constants.h"
111 #include "ui/base/ime/chromeos/extension_ime_util.h" 110 #include "ui/base/ime/chromeos/extension_ime_util.h"
112 #include "ui/base/ime/chromeos/ime_keyboard.h" 111 #include "ui/base/ime/chromeos/ime_keyboard.h"
113 #include "ui/base/ime/chromeos/input_method_manager.h" 112 #include "ui/base/ime/chromeos/input_method_manager.h"
114 #include "ui/base/l10n/l10n_util.h" 113 #include "ui/base/l10n/l10n_util.h"
115 #include "ui/base/l10n/time_format.h" 114 #include "ui/base/l10n/time_format.h"
116 #include "ui/chromeos/ime/input_method_menu_item.h" 115 #include "ui/chromeos/ime/input_method_menu_item.h"
117 #include "ui/chromeos/ime/input_method_menu_manager.h" 116 #include "ui/chromeos/ime/input_method_menu_manager.h"
118 117
119 #if defined(ENABLE_SUPERVISED_USERS) 118 #if defined(ENABLE_SUPERVISED_USERS)
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 ash::WmShell* wm_shell = ash::WmShell::Get(); 400 ash::WmShell* wm_shell = ash::WmShell::Get();
402 return ChromeUserManager::Get()->GetCurrentUserFlow()->ShouldShowSettings() && 401 return ChromeUserManager::Get()->GetCurrentUserFlow()->ShouldShowSettings() &&
403 !wm_shell->GetSessionStateDelegate()->IsInSecondaryLoginScreen(); 402 !wm_shell->GetSessionStateDelegate()->IsInSecondaryLoginScreen();
404 } 403 }
405 404
406 void SystemTrayDelegateChromeOS::ShowSetTimeDialog() { 405 void SystemTrayDelegateChromeOS::ShowSetTimeDialog() {
407 // TODO(mash): Refactor out GetNativeWindow and move to SystemTrayClient. 406 // TODO(mash): Refactor out GetNativeWindow and move to SystemTrayClient.
408 SetTimeDialog::ShowDialog(GetNativeWindow()); 407 SetTimeDialog::ShowDialog(GetNativeWindow());
409 } 408 }
410 409
411 void SystemTrayDelegateChromeOS::ShowNetworkSettingsForGuid(
412 const std::string& guid) {
413 // TODO(mash): Refactor out SessionStateDelegate and move to SystemTrayClient.
414 ash::WmShell* wm_shell = ash::WmShell::Get();
415 if (LoginState::Get()->IsUserLoggedIn() &&
416 !wm_shell->GetSessionStateDelegate()->IsInSecondaryLoginScreen()) {
417 std::string page = chrome::kInternetOptionsSubPage;
418 if (!guid.empty())
419 page += "?guid=" + net::EscapeUrlEncodedData(guid, true);
420 content::RecordAction(base::UserMetricsAction("OpenInternetOptionsDialog"));
421 ShowSettingsSubPageForActiveUser(page);
422 }
423 }
424
425 bool SystemTrayDelegateChromeOS::ShouldShowDisplayNotification() { 410 bool SystemTrayDelegateChromeOS::ShouldShowDisplayNotification() {
426 // Packaged app is not counted as 'last active', so if a browser opening the 411 // Packaged app is not counted as 'last active', so if a browser opening the
427 // display settings is in background of a packaged app, it will return true. 412 // display settings is in background of a packaged app, it will return true.
428 // TODO(mukai): fix this. 413 // TODO(mukai): fix this.
429 Browser* active_browser = chrome::FindLastActive(); 414 Browser* active_browser = chrome::FindLastActive();
430 if (!active_browser) 415 if (!active_browser)
431 return true; 416 return true;
432 417
433 content::WebContents* active_contents = 418 content::WebContents* active_contents =
434 active_browser->tab_strip_model()->GetActiveWebContents(); 419 active_browser->tab_strip_model()->GetActiveWebContents();
(...skipping 782 matching lines...) Expand 10 before | Expand all | Expand 10 after
1217 LOG(WARNING) << "SystemTrayDelegateChromeOS::GetChildUserMessage call while " 1202 LOG(WARNING) << "SystemTrayDelegateChromeOS::GetChildUserMessage call while "
1218 << "ENABLE_SUPERVISED_USERS undefined."; 1203 << "ENABLE_SUPERVISED_USERS undefined.";
1219 return base::string16(); 1204 return base::string16();
1220 } 1205 }
1221 1206
1222 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { 1207 ash::SystemTrayDelegate* CreateSystemTrayDelegate() {
1223 return new SystemTrayDelegateChromeOS(); 1208 return new SystemTrayDelegateChromeOS();
1224 } 1209 }
1225 1210
1226 } // namespace chromeos 1211 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698