From f92607ac6adf31458746cdba937193e6b21f4214 Mon Sep 17 00:00:00 2001 From: "oshima@chromium.org" Date: Wed, 17 Oct 2012 21:55:45 +0000 Subject: Remove obsolete code for secondary display BUG=none TEST=none Review URL: https://chromiumcodereview.appspot.com/11194032 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@162544 0039d316-1c4b-4281-b951-d872f2087c98 --- ash/display/secondary_display_view.cc | 111 ---------------------------------- ash/display/secondary_display_view.h | 24 -------- 2 files changed, 135 deletions(-) delete mode 100644 ash/display/secondary_display_view.cc delete mode 100644 ash/display/secondary_display_view.h (limited to 'ash/display') diff --git a/ash/display/secondary_display_view.cc b/ash/display/secondary_display_view.cc deleted file mode 100644 index a79237b..0000000 --- a/ash/display/secondary_display_view.cc +++ /dev/null @@ -1,111 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "ash/display/secondary_display_view.h" - -#include "grit/ash_resources.h" -#include "grit/ash_strings.h" -#include "third_party/skia/include/core/SkColor.h" -#include "ui/aura/window.h" -#include "ui/base/l10n/l10n_util.h" -#include "ui/base/resource/resource_bundle.h" -#include "ui/views/background.h" -#include "ui/views/controls/image_view.h" -#include "ui/views/controls/label.h" -#include "ui/views/view.h" -#include "ui/views/widget/widget.h" -#include "ui/views/widget/widget_delegate.h" - -namespace ash { -namespace { - -// Colors for the background, the message text and the shortcut text. -const SkColor kBackgroundColor = SkColorSetRGB(0x33, 0x33, 0x33); -const SkColor kTextColor = SkColorSetRGB(127, 127, 127); - -// A view to be displayed on secondary display. -class SecondaryDisplayView : public views::WidgetDelegateView { - public: - SecondaryDisplayView() { - Init(); - } - virtual ~SecondaryDisplayView() { - } - - void Init() { - ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); - - set_background(views::Background::CreateSolidBackground(kBackgroundColor)); - message_ = new views::Label( - l10n_util::GetStringUTF16(IDS_ASH_SECONDARY_MONITOR)); - message_->SetAutoColorReadabilityEnabled(false); - message_->SetFont(rb.GetFont(ui::ResourceBundle::LargeFont)); - message_->SetHorizontalAlignment(views::Label::ALIGN_CENTER); - message_->SetEnabledColor(kTextColor); - AddChildView(message_); - - shortcut_text_ = new views::Label( - l10n_util::GetStringUTF16(IDS_ASH_SECONDARY_MONITOR_SHORTCUT)); - shortcut_text_->SetAutoColorReadabilityEnabled(false); - shortcut_text_->SetFont(rb.GetFont(ui::ResourceBundle::MediumFont)); - shortcut_text_->SetHorizontalAlignment(views::Label::ALIGN_CENTER); - shortcut_text_->SetEnabledColor(kTextColor); - AddChildView(shortcut_text_); - - shortcut_image_ = new views::ImageView(); - shortcut_image_->SetImage(rb.GetImageSkiaNamed(IDR_AURA_SWITCH_MONITOR)); - AddChildView(shortcut_image_); - } - - virtual void Layout() { - const int kMessagePositionTopMargin = 40; - const int kShortcutPositionBottomMargin = 40; - const int kShortcutMargin = 4; // margin between text and image. - gfx::Rect b = bounds(); - - int msg_height = message_->GetHeightForWidth(b.width()); - message_->SetBounds( - 0, kMessagePositionTopMargin, bounds().width(), msg_height); - - // TODO(oshima): Figure out what to do for RTL. - // Align the shortcut text & image to the center. - gfx::Size text_size = shortcut_text_->GetPreferredSize(); - gfx::Size image_size = shortcut_image_->GetPreferredSize(); - int height = std::max(text_size.height(), image_size.height()); - int y = b.height() - kShortcutPositionBottomMargin - height; - int x = (b.width() - - (text_size.width() + kShortcutMargin + image_size.width())) / 2; - shortcut_text_->SetBounds(x, y + (height - text_size.height()) / 2, - text_size.width(), text_size.height()); - shortcut_image_->SetBounds( - x + text_size.width() + kShortcutMargin, - y + (height - image_size.height()) / 2, - image_size.width(), image_size.height()); - } - - private: - views::Label* message_; - views::Label* shortcut_text_; - views::ImageView* shortcut_image_; - - DISALLOW_COPY_AND_ASSIGN(SecondaryDisplayView); -}; - -} // namespace - -views::Widget* CreateSecondaryDisplayWidget(aura::Window* parent) { - views::Widget* desktop_widget = new views::Widget; - views::Widget::InitParams params( - views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); - SecondaryDisplayView* view = new SecondaryDisplayView(); - params.delegate = view; - params.parent = parent; - desktop_widget->Init(params); - desktop_widget->SetContentsView(view); - desktop_widget->Show(); - desktop_widget->GetNativeView()->SetName("SecondaryDisplay"); - return desktop_widget; -} - -} // namespace ash diff --git a/ash/display/secondary_display_view.h b/ash/display/secondary_display_view.h deleted file mode 100644 index c9cff10..0000000 --- a/ash/display/secondary_display_view.h +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef ASH_DISPLAY_SECONDARY_DISPLAY_VIEW_H_ -#define ASH_DISPLAY_SECONDARY_DISPLAY_VIEW_H_ - -namespace aura { -class Window; -} - -namespace views { -class Widget; -} - -namespace ash { - -// Creates the widget that hosts the static message displayed on the -// secondary display. -views::Widget* CreateSecondaryDisplayWidget(aura::Window* parent); - -} // namespace ash - -#endif // ASH_DISPLAY_SECONDARY_DISPLAY_VIEW_H_ -- cgit v1.1