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

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: rebase 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 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 ash::WmShell* wm_shell = ash::WmShell::Get(); 394 ash::WmShell* wm_shell = ash::WmShell::Get();
396 return ChromeUserManager::Get()->GetCurrentUserFlow()->ShouldShowSettings() && 395 return ChromeUserManager::Get()->GetCurrentUserFlow()->ShouldShowSettings() &&
397 !wm_shell->GetSessionStateDelegate()->IsInSecondaryLoginScreen(); 396 !wm_shell->GetSessionStateDelegate()->IsInSecondaryLoginScreen();
398 } 397 }
399 398
400 void SystemTrayDelegateChromeOS::ShowSetTimeDialog() { 399 void SystemTrayDelegateChromeOS::ShowSetTimeDialog() {
401 // TODO(mash): Refactor out GetNativeWindow and move to SystemTrayClient. 400 // TODO(mash): Refactor out GetNativeWindow and move to SystemTrayClient.
402 SetTimeDialog::ShowDialog(GetNativeWindow()); 401 SetTimeDialog::ShowDialog(GetNativeWindow());
403 } 402 }
404 403
405 void SystemTrayDelegateChromeOS::ShowNetworkSettingsForGuid(
406 const std::string& guid) {
407 // TODO(mash): Refactor out SessionStateDelegate and move to SystemTrayClient.
408 ash::WmShell* wm_shell = ash::WmShell::Get();
409 if (LoginState::Get()->IsUserLoggedIn() &&
410 !wm_shell->GetSessionStateDelegate()->IsInSecondaryLoginScreen()) {
411 std::string page = chrome::kInternetOptionsSubPage;
412 if (!guid.empty())
413 page += "?guid=" + net::EscapeUrlEncodedData(guid, true);
414 content::RecordAction(base::UserMetricsAction("OpenInternetOptionsDialog"));
415 ShowSettingsSubPageForActiveUser(page);
416 }
417 }
418
419 bool SystemTrayDelegateChromeOS::ShouldShowDisplayNotification() { 404 bool SystemTrayDelegateChromeOS::ShouldShowDisplayNotification() {
420 // Packaged app is not counted as 'last active', so if a browser opening the 405 // Packaged app is not counted as 'last active', so if a browser opening the
421 // display settings is in background of a packaged app, it will return true. 406 // display settings is in background of a packaged app, it will return true.
422 // TODO(mukai): fix this. 407 // TODO(mukai): fix this.
423 Browser* active_browser = chrome::FindLastActive(); 408 Browser* active_browser = chrome::FindLastActive();
424 if (!active_browser) 409 if (!active_browser)
425 return true; 410 return true;
426 411
427 content::WebContents* active_contents = 412 content::WebContents* active_contents =
428 active_browser->tab_strip_model()->GetActiveWebContents(); 413 active_browser->tab_strip_model()->GetActiveWebContents();
(...skipping 782 matching lines...) Expand 10 before | Expand all | Expand 10 after
1211 LOG(WARNING) << "SystemTrayDelegateChromeOS::GetChildUserMessage call while " 1196 LOG(WARNING) << "SystemTrayDelegateChromeOS::GetChildUserMessage call while "
1212 << "ENABLE_SUPERVISED_USERS undefined."; 1197 << "ENABLE_SUPERVISED_USERS undefined.";
1213 return base::string16(); 1198 return base::string16();
1214 } 1199 }
1215 1200
1216 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { 1201 ash::SystemTrayDelegate* CreateSystemTrayDelegate() {
1217 return new SystemTrayDelegateChromeOS(); 1202 return new SystemTrayDelegateChromeOS();
1218 } 1203 }
1219 1204
1220 } // namespace chromeos 1205 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698