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

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

Issue 759063002: Move Screen Rotation from MaximizeModeController to ScreenOrientationController (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update Helper code Created 5 years, 11 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 (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/tray_display.h" 5 #include "ash/system/chromeos/tray_display.h"
6 6
7 #include <vector>
8
9 #include "ash/content/display/screen_orientation_controller_chromeos.h"
7 #include "ash/display/display_controller.h" 10 #include "ash/display/display_controller.h"
8 #include "ash/display/display_manager.h" 11 #include "ash/display/display_manager.h"
9 #include "ash/shell.h" 12 #include "ash/shell.h"
10 #include "ash/system/system_notifier.h" 13 #include "ash/system/system_notifier.h"
11 #include "ash/system/tray/actionable_view.h" 14 #include "ash/system/tray/actionable_view.h"
12 #include "ash/system/tray/fixed_sized_image_view.h" 15 #include "ash/system/tray/fixed_sized_image_view.h"
13 #include "ash/system/tray/system_tray.h" 16 #include "ash/system/tray/system_tray.h"
14 #include "ash/system/tray/system_tray_delegate.h" 17 #include "ash/system/tray/system_tray_delegate.h"
15 #include "ash/system/tray/tray_constants.h" 18 #include "ash/system/tray/tray_constants.h"
16 #include "ash/system/tray/tray_notification_view.h" 19 #include "ash/system/tray/tray_notification_view.h"
17 #include "ash/wm/maximize_mode/maximize_mode_controller.h"
18 #include "base/bind.h" 20 #include "base/bind.h"
19 #include "base/strings/string_util.h" 21 #include "base/strings/string_util.h"
20 #include "base/strings/utf_string_conversions.h" 22 #include "base/strings/utf_string_conversions.h"
21 #include "grit/ash_resources.h" 23 #include "grit/ash_resources.h"
22 #include "grit/ash_strings.h" 24 #include "grit/ash_strings.h"
23 #include "ui/base/l10n/l10n_util.h" 25 #include "ui/base/l10n/l10n_util.h"
24 #include "ui/base/resource/resource_bundle.h" 26 #include "ui/base/resource/resource_bundle.h"
25 #include "ui/message_center/message_center.h" 27 #include "ui/message_center/message_center.h"
26 #include "ui/message_center/notification.h" 28 #include "ui/message_center/notification.h"
27 #include "ui/message_center/notification_delegate.h" 29 #include "ui/message_center/notification_delegate.h"
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 message = GetDisplayInfoLine(GetDisplayManager()->first_display_id()); 163 message = GetDisplayInfoLine(GetDisplayManager()->first_display_id());
162 SetVisible(!message.empty()); 164 SetVisible(!message.empty());
163 label_->SetText(message); 165 label_->SetText(message);
164 SetAccessibleName(message); 166 SetAccessibleName(message);
165 Layout(); 167 Layout();
166 } 168 }
167 169
168 const views::Label* label() const { return label_; } 170 const views::Label* label() const { return label_; }
169 171
170 // Overridden from views::View. 172 // Overridden from views::View.
171 virtual bool GetTooltipText(const gfx::Point& p, 173 bool GetTooltipText(const gfx::Point& p,
172 base::string16* tooltip) const override { 174 base::string16* tooltip) const override {
173 base::string16 tray_message = GetTrayDisplayMessage(NULL); 175 base::string16 tray_message = GetTrayDisplayMessage(NULL);
174 base::string16 display_message = GetAllDisplayInfo(); 176 base::string16 display_message = GetAllDisplayInfo();
175 if (tray_message.empty() && display_message.empty()) 177 if (tray_message.empty() && display_message.empty())
176 return false; 178 return false;
177 179
178 *tooltip = tray_message + base::ASCIIToUTF16("\n") + display_message; 180 *tooltip = tray_message + base::ASCIIToUTF16("\n") + display_message;
179 return true; 181 return true;
180 } 182 }
181 183
182 // Returns the name of the currently connected external display. 184 // Returns the name of the currently connected external display.
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 bool ShouldShowFirstDisplayInfo() const { 263 bool ShouldShowFirstDisplayInfo() const {
262 const DisplayInfo& display_info = GetDisplayManager()->GetDisplayInfo( 264 const DisplayInfo& display_info = GetDisplayManager()->GetDisplayInfo(
263 GetDisplayManager()->first_display_id()); 265 GetDisplayManager()->first_display_id());
264 return display_info.rotation() != gfx::Display::ROTATE_0 || 266 return display_info.rotation() != gfx::Display::ROTATE_0 ||
265 display_info.configured_ui_scale() != 1.0f || 267 display_info.configured_ui_scale() != 1.0f ||
266 !display_info.overscan_insets_in_dip().empty() || 268 !display_info.overscan_insets_in_dip().empty() ||
267 display_info.has_overscan(); 269 display_info.has_overscan();
268 } 270 }
269 271
270 // Overridden from ActionableView. 272 // Overridden from ActionableView.
271 virtual bool PerformAction(const ui::Event& event) override { 273 bool PerformAction(const ui::Event& event) override {
272 OpenSettings(); 274 OpenSettings();
273 return true; 275 return true;
274 } 276 }
275 277
276 virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) override { 278 void OnBoundsChanged(const gfx::Rect& previous_bounds) override {
277 int label_max_width = bounds().width() - kTrayPopupPaddingHorizontal * 2 - 279 int label_max_width = bounds().width() - kTrayPopupPaddingHorizontal * 2 -
278 kTrayPopupPaddingBetweenItems - image_->GetPreferredSize().width(); 280 kTrayPopupPaddingBetweenItems - image_->GetPreferredSize().width();
279 label_->SizeToFit(label_max_width); 281 label_->SizeToFit(label_max_width);
280 } 282 }
281 283
282 views::ImageView* image_; 284 views::ImageView* image_;
283 views::Label* label_; 285 views::Label* label_;
284 286
285 DISALLOW_COPY_AND_ASSIGN(DisplayView); 287 DISALLOW_COPY_AND_ASSIGN(DisplayView);
286 }; 288 };
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 // Always remove the notification to make sure the notification appears 374 // Always remove the notification to make sure the notification appears
373 // as a popup in any situation. 375 // as a popup in any situation.
374 message_center::MessageCenter::Get()->RemoveNotification( 376 message_center::MessageCenter::Get()->RemoveNotification(
375 kNotificationId, false /* by_user */); 377 kNotificationId, false /* by_user */);
376 378
377 if (message.empty()) 379 if (message.empty())
378 return; 380 return;
379 381
380 // Don't display notifications for accelerometer triggered screen rotations. 382 // Don't display notifications for accelerometer triggered screen rotations.
381 // See http://crbug.com/364949 383 // See http://crbug.com/364949
382 if (Shell::GetInstance()->maximize_mode_controller()-> 384 if (Shell::GetInstance()
383 ignore_display_configuration_updates()) { 385 ->screen_orientation_controller()
386 ->ignore_display_configuration_updates()) {
384 return; 387 return;
385 } 388 }
386 389
387 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); 390 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance();
388 scoped_ptr<Notification> notification(new Notification( 391 scoped_ptr<Notification> notification(new Notification(
389 message_center::NOTIFICATION_TYPE_SIMPLE, 392 message_center::NOTIFICATION_TYPE_SIMPLE,
390 kNotificationId, 393 kNotificationId,
391 message, 394 message,
392 additional_message, 395 additional_message,
393 bundle.GetImageNamed(IDR_AURA_NOTIFICATION_DISPLAY), 396 bundle.GetImageNamed(IDR_AURA_NOTIFICATION_DISPLAY),
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 bool TrayDisplay::GetAccessibleStateForTesting(ui::AXViewState* state) { 443 bool TrayDisplay::GetAccessibleStateForTesting(ui::AXViewState* state) {
441 views::View* view = default_; 444 views::View* view = default_;
442 if (view) { 445 if (view) {
443 view->GetAccessibleState(state); 446 view->GetAccessibleState(state);
444 return true; 447 return true;
445 } 448 }
446 return false; 449 return false;
447 } 450 }
448 451
449 } // namespace ash 452 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698