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

Side by Side Diff: ash/shell/lock_view.cc

Issue 2901503003: Rename GetPreferredSize to CalculatePreferredSize in ash/ (Closed)
Patch Set: Created 3 years, 7 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/public/cpp/shell_window_ids.h" 5 #include "ash/public/cpp/shell_window_ids.h"
6 #include "ash/session/session_controller.h" 6 #include "ash/session/session_controller.h"
7 #include "ash/shell.h" 7 #include "ash/shell.h"
8 #include "ash/shell/example_factory.h" 8 #include "ash/shell/example_factory.h"
9 #include "ash/shell/example_session_controller_client.h" 9 #include "ash/shell/example_session_controller_client.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 15 matching lines...) Expand all
26 public views::ButtonListener { 26 public views::ButtonListener {
27 public: 27 public:
28 LockView() 28 LockView()
29 : unlock_button_( 29 : unlock_button_(
30 views::MdTextButton::Create(this, base::ASCIIToUTF16("Unlock"))) { 30 views::MdTextButton::Create(this, base::ASCIIToUTF16("Unlock"))) {
31 AddChildView(unlock_button_); 31 AddChildView(unlock_button_);
32 } 32 }
33 ~LockView() override {} 33 ~LockView() override {}
34 34
35 // Overridden from views::View: 35 // Overridden from views::View:
36 gfx::Size GetPreferredSize() const override { return gfx::Size(500, 400); } 36 gfx::Size CalculatePreferredSize() const override {
37 return gfx::Size(500, 400);
sky 2017/05/22 17:30:58 set_preferred_size() instead?
38 }
37 39
38 private: 40 private:
39 // Overridden from views::View: 41 // Overridden from views::View:
40 void OnPaint(gfx::Canvas* canvas) override { 42 void OnPaint(gfx::Canvas* canvas) override {
41 canvas->FillRect(GetLocalBounds(), SK_ColorYELLOW); 43 canvas->FillRect(GetLocalBounds(), SK_ColorYELLOW);
42 base::string16 text = base::ASCIIToUTF16("LOCKED!"); 44 base::string16 text = base::ASCIIToUTF16("LOCKED!");
43 int string_width = gfx::GetStringWidth(text, font_list_); 45 int string_width = gfx::GetStringWidth(text, font_list_);
44 canvas->DrawStringRect(text, font_list_, SK_ColorRED, 46 canvas->DrawStringRect(text, font_list_, SK_ColorRED,
45 gfx::Rect((width() - string_width) / 2, 47 gfx::Rect((width() - string_width) / 2,
46 (height() - font_list_.GetHeight()) / 2, 48 (height() - font_list_.GetHeight()) / 2,
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 widget->Show(); 97 widget->Show();
96 widget->GetNativeView()->SetName("LockView"); 98 widget->GetNativeView()->SetName("LockView");
97 widget->GetNativeView()->Focus(); 99 widget->GetNativeView()->Focus();
98 100
99 // TODO: it shouldn't be necessary to invoke UpdateTooltip() here. 101 // TODO: it shouldn't be necessary to invoke UpdateTooltip() here.
100 Shell::Get()->tooltip_controller()->UpdateTooltip(widget->GetNativeView()); 102 Shell::Get()->tooltip_controller()->UpdateTooltip(widget->GetNativeView());
101 } 103 }
102 104
103 } // namespace shell 105 } // namespace shell
104 } // namespace ash 106 } // namespace ash
OLDNEW
« no previous file with comments | « ash/shelf/shelf_view.cc ('k') | ash/shell/panel_window.h » ('j') | ash/shell/panel_window.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698