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

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: Change similarity to account for moved files Created 6 years 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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 message = GetDisplayInfoLine(GetDisplayManager()->first_display_id()); 164 message = GetDisplayInfoLine(GetDisplayManager()->first_display_id());
163 SetVisible(!message.empty()); 165 SetVisible(!message.empty());
164 label_->SetText(message); 166 label_->SetText(message);
165 SetAccessibleName(message); 167 SetAccessibleName(message);
166 Layout(); 168 Layout();
167 } 169 }
168 170
169 const views::Label* label() const { return label_; } 171 const views::Label* label() const { return label_; }
170 172
171 // Overridden from views::View. 173 // Overridden from views::View.
172 virtual bool GetTooltipText(const gfx::Point& p, 174 bool GetTooltipText(const gfx::Point& p,
173 base::string16* tooltip) const override { 175 base::string16* tooltip) const override {
174 base::string16 tray_message = GetTrayDisplayMessage(NULL); 176 base::string16 tray_message = GetTrayDisplayMessage(NULL);
175 base::string16 display_message = GetAllDisplayInfo(); 177 base::string16 display_message = GetAllDisplayInfo();
176 if (tray_message.empty() && display_message.empty()) 178 if (tray_message.empty() && display_message.empty())
177 return false; 179 return false;
178 180
179 *tooltip = tray_message + base::ASCIIToUTF16("\n") + display_message; 181 *tooltip = tray_message + base::ASCIIToUTF16("\n") + display_message;
180 return true; 182 return true;
181 } 183 }
182 184
183 // Returns the name of the currently connected external display. 185 // Returns the name of the currently connected external display.
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 bool ShouldShowFirstDisplayInfo() const { 264 bool ShouldShowFirstDisplayInfo() const {
263 const DisplayInfo& display_info = GetDisplayManager()->GetDisplayInfo( 265 const DisplayInfo& display_info = GetDisplayManager()->GetDisplayInfo(
264 GetDisplayManager()->first_display_id()); 266 GetDisplayManager()->first_display_id());
265 return display_info.rotation() != gfx::Display::ROTATE_0 || 267 return display_info.rotation() != gfx::Display::ROTATE_0 ||
266 display_info.configured_ui_scale() != 1.0f || 268 display_info.configured_ui_scale() != 1.0f ||
267 !display_info.overscan_insets_in_dip().empty() || 269 !display_info.overscan_insets_in_dip().empty() ||
268 display_info.has_overscan(); 270 display_info.has_overscan();
269 } 271 }
270 272
271 // Overridden from ActionableView. 273 // Overridden from ActionableView.
272 virtual bool PerformAction(const ui::Event& event) override { 274 bool PerformAction(const ui::Event& event) override {
273 OpenSettings(); 275 OpenSettings();
274 return true; 276 return true;
275 } 277 }
276 278
277 virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) override { 279 void OnBoundsChanged(const gfx::Rect& previous_bounds) override {
278 int label_max_width = bounds().width() - kTrayPopupPaddingHorizontal * 2 - 280 int label_max_width = bounds().width() - kTrayPopupPaddingHorizontal * 2 -
279 kTrayPopupPaddingBetweenItems - image_->GetPreferredSize().width(); 281 kTrayPopupPaddingBetweenItems - image_->GetPreferredSize().width();
280 label_->SizeToFit(label_max_width); 282 label_->SizeToFit(label_max_width);
281 } 283 }
282 284
283 views::ImageView* image_; 285 views::ImageView* image_;
284 views::Label* label_; 286 views::Label* label_;
285 287
286 DISALLOW_COPY_AND_ASSIGN(DisplayView); 288 DISALLOW_COPY_AND_ASSIGN(DisplayView);
287 }; 289 };
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 // Always remove the notification to make sure the notification appears 375 // Always remove the notification to make sure the notification appears
374 // as a popup in any situation. 376 // as a popup in any situation.
375 message_center::MessageCenter::Get()->RemoveNotification( 377 message_center::MessageCenter::Get()->RemoveNotification(
376 kNotificationId, false /* by_user */); 378 kNotificationId, false /* by_user */);
377 379
378 if (message.empty()) 380 if (message.empty())
379 return; 381 return;
380 382
381 // Don't display notifications for accelerometer triggered screen rotations. 383 // Don't display notifications for accelerometer triggered screen rotations.
382 // See http://crbug.com/364949 384 // See http://crbug.com/364949
383 if (Shell::GetInstance()->maximize_mode_controller()-> 385 if (Shell::GetInstance()
384 ignore_display_configuration_updates()) { 386 ->screen_orientation_controller()
387 ->ignore_display_configuration_updates()) {
385 return; 388 return;
386 } 389 }
387 390
388 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); 391 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance();
389 scoped_ptr<Notification> notification(new Notification( 392 scoped_ptr<Notification> notification(new Notification(
390 message_center::NOTIFICATION_TYPE_SIMPLE, 393 message_center::NOTIFICATION_TYPE_SIMPLE,
391 kNotificationId, 394 kNotificationId,
392 message, 395 message,
393 additional_message, 396 additional_message,
394 bundle.GetImageNamed(IDR_AURA_NOTIFICATION_DISPLAY), 397 bundle.GetImageNamed(IDR_AURA_NOTIFICATION_DISPLAY),
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 bool TrayDisplay::GetAccessibleStateForTesting(ui::AXViewState* state) { 444 bool TrayDisplay::GetAccessibleStateForTesting(ui::AXViewState* state) {
442 views::View* view = default_; 445 views::View* view = default_;
443 if (view) { 446 if (view) {
444 view->GetAccessibleState(state); 447 view->GetAccessibleState(state);
445 return true; 448 return true;
446 } 449 }
447 return false; 450 return false;
448 } 451 }
449 452
450 } // namespace ash 453 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698