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

Side by Side Diff: ash/system/chromeos/screen_layout_observer.cc

Issue 2714543003: Remove docked-mode notification (Closed)
Patch Set: Created 3 years, 10 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
« no previous file with comments | « ash/ash_chromeos_strings.grdp ('k') | ash/system/chromeos/screen_layout_observer_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 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 "ash/system/chromeos/screen_layout_observer.h" 5 #include "ash/system/chromeos/screen_layout_observer.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 if (display::Display::IsInternalDisplayId( 145 if (display::Display::IsInternalDisplayId(
146 display_manager->GetDisplayAt(i).id())) { 146 display_manager->GetDisplayAt(i).id())) {
147 return false; 147 return false;
148 } 148 }
149 } 149 }
150 150
151 // We have an internal display but it's not one of the active displays. 151 // We have an internal display but it's not one of the active displays.
152 return true; 152 return true;
153 } 153 }
154 154
155 // Returns the notification message that should be shown to the user when the
156 // docked mode is entered.
157 base::string16 GetDockedModeEnabledMessage(
158 base::string16* out_additional_message) {
159 DCHECK(IsDockedModeEnabled());
160 DCHECK(out_additional_message);
161
162 *out_additional_message = ash::SubstituteChromeOSDeviceType(
163 IDS_ASH_STATUS_TRAY_DISPLAY_DOCKED_DESCRIPTION);
164 return l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_DISPLAY_DOCKED);
165 }
166
167 // Returns the notification message that should be shown when mirror display 155 // Returns the notification message that should be shown when mirror display
168 // mode is entered. 156 // mode is entered.
169 base::string16 GetEnterMirrorModeMessage() { 157 base::string16 GetEnterMirrorModeMessage() {
170 if (display::Display::HasInternalDisplay()) { 158 if (display::Display::HasInternalDisplay()) {
171 return l10n_util::GetStringFUTF16( 159 return l10n_util::GetStringFUTF16(
172 IDS_ASH_STATUS_TRAY_DISPLAY_MIRRORING, 160 IDS_ASH_STATUS_TRAY_DISPLAY_MIRRORING,
173 GetDisplayName(GetDisplayManager()->mirroring_display_id())); 161 GetDisplayName(GetDisplayManager()->mirroring_display_id()));
174 } 162 }
175 163
176 return l10n_util::GetStringUTF16( 164 return l10n_util::GetStringUTF16(
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 // Detect changes in the unified mode status. 241 // Detect changes in the unified mode status.
254 if (current_display_mode_ == DisplayMode::UNIFIED) { 242 if (current_display_mode_ == DisplayMode::UNIFIED) {
255 *out_message = GetEnterUnifiedModeMessage(); 243 *out_message = GetEnterUnifiedModeMessage();
256 return true; 244 return true;
257 } 245 }
258 if (old_display_mode_ == DisplayMode::UNIFIED) { 246 if (old_display_mode_ == DisplayMode::UNIFIED) {
259 *out_message = GetExitUnifiedModeMessage(); 247 *out_message = GetExitUnifiedModeMessage();
260 return true; 248 return true;
261 } 249 }
262 250
263 if (current_display_mode_ == DisplayMode::DOCKED) { 251 if (current_display_mode_ == DisplayMode::DOCKED ||
264 *out_message = GetDockedModeEnabledMessage(out_additional_message); 252 old_display_mode_ == DisplayMode::DOCKED) {
265 return true; 253 // We no longer show any notification for docked mode events.
266 } 254 // crbug.com/674719.
267 if (old_display_mode_ == DisplayMode::DOCKED) { 255 return false;
268 *out_message =
269 l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_DISPLAY_DOCKED_EXITING);
270 return true;
271 } 256 }
272 } 257 }
273 258
274 // Displays are added or removed. 259 // Displays are added or removed.
275 if (display_info_.size() < old_info.size()) { 260 if (display_info_.size() < old_info.size()) {
276 // A display has been removed. 261 // A display has been removed.
277 for (const auto& iter : old_info) { 262 for (const auto& iter : old_info) {
278 if (display_info_.count(iter.first)) 263 if (display_info_.count(iter.first))
279 continue; 264 continue;
280 265
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 base::string16 message; 385 base::string16 message;
401 base::string16 additional_message; 386 base::string16 additional_message;
402 if (GetDisplayMessageForNotification(old_info, &message, &additional_message)) 387 if (GetDisplayMessageForNotification(old_info, &message, &additional_message))
403 CreateOrUpdateNotification(message, additional_message); 388 CreateOrUpdateNotification(message, additional_message);
404 } 389 }
405 390
406 bool ScreenLayoutObserver::GetExitMirrorModeMessage( 391 bool ScreenLayoutObserver::GetExitMirrorModeMessage(
407 base::string16* out_message, 392 base::string16* out_message,
408 base::string16* out_additional_message) { 393 base::string16* out_additional_message) {
409 switch (current_display_mode_) { 394 switch (current_display_mode_) {
410 case DisplayMode::DOCKED:
411 // Handle disabling mirror mode as a result of going to docked mode
412 // when we only have a single display (this means we actually have two
413 // physical displays, one of which is the internal display, but they
414 // were in mirror mode, and hence considered as one. Closing the
415 // internal display disables mirror mode and we still have a single
416 // active display).
417 *out_message = GetDockedModeEnabledMessage(out_additional_message);
418 return true;
419
420 case DisplayMode::EXTENDED_3_PLUS: 395 case DisplayMode::EXTENDED_3_PLUS:
421 // Mirror mode was turned off due to having more than two displays. 396 // Mirror mode was turned off due to having more than two displays.
422 // Show a message that mirror mode for 3+ displays is not supported. 397 // Show a message that mirror mode for 3+ displays is not supported.
423 *out_message = 398 *out_message =
424 l10n_util::GetStringUTF16(IDS_ASH_DISPLAY_MIRRORING_NOT_SUPPORTED); 399 l10n_util::GetStringUTF16(IDS_ASH_DISPLAY_MIRRORING_NOT_SUPPORTED);
425 return true; 400 return true;
426 401
402 case DisplayMode::DOCKED:
403 // Handle disabling mirror mode as a result of going to docked mode
404 // when we only have a single display (this means we actually have two
405 // physical displays, one of which is the internal display, but they
406 // were in mirror mode, and hence considered as one. Closing the
407 // internal display disables mirror mode and we still have a single
408 // active display).
409 // Falls through.
427 case DisplayMode::SINGLE: 410 case DisplayMode::SINGLE:
428 // We're exiting mirror mode because we removed one of the two 411 // We're exiting mirror mode because we removed one of the two
429 // displays. 412 // displays.
430 *out_message = 413 *out_message =
431 l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_DISPLAY_MIRROR_EXIT); 414 l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_DISPLAY_MIRROR_EXIT);
432 return true; 415 return true;
433 416
434 default: 417 default:
435 // Mirror mode was turned off; other messages should be shown e.g. 418 // Mirror mode was turned off; other messages should be shown e.g.
436 // extended mode is on, ... etc. 419 // extended mode is on, ... etc.
437 return false; 420 return false;
438 } 421 }
439 } 422 }
440 423
441 } // namespace ash 424 } // namespace ash
OLDNEW
« no previous file with comments | « ash/ash_chromeos_strings.grdp ('k') | ash/system/chromeos/screen_layout_observer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698