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

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

Issue 273223002: views: Make view::Views::GetPreferredSize() const. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More compile fix for ToT Created 6 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 | Annotate | Revision Log
« no previous file with comments | « ash/shelf/shelf_view.cc ('k') | ash/shell/panel_window.h » ('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/session/session_state_delegate.h" 5 #include "ash/session/session_state_delegate.h"
6 #include "ash/shell.h" 6 #include "ash/shell.h"
7 #include "ash/shell/example_factory.h" 7 #include "ash/shell/example_factory.h"
8 #include "ash/shell_window_ids.h" 8 #include "ash/shell_window_ids.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "ui/aura/window.h" 10 #include "ui/aura/window.h"
(...skipping 17 matching lines...) Expand all
28 public: 28 public:
29 LockView() : unlock_button_(new views::LabelButton( 29 LockView() : unlock_button_(new views::LabelButton(
30 this, base::ASCIIToUTF16("Unlock"))) { 30 this, base::ASCIIToUTF16("Unlock"))) {
31 unlock_button_->SetStyle(views::Button::STYLE_BUTTON); 31 unlock_button_->SetStyle(views::Button::STYLE_BUTTON);
32 AddChildView(unlock_button_); 32 AddChildView(unlock_button_);
33 unlock_button_->SetFocusable(true); 33 unlock_button_->SetFocusable(true);
34 } 34 }
35 virtual ~LockView() {} 35 virtual ~LockView() {}
36 36
37 // Overridden from views::View: 37 // Overridden from views::View:
38 virtual gfx::Size GetPreferredSize() OVERRIDE { 38 virtual gfx::Size GetPreferredSize() const OVERRIDE {
39 return gfx::Size(500, 400); 39 return gfx::Size(500, 400);
40 } 40 }
41 41
42 private: 42 private:
43 // Overridden from views::View: 43 // Overridden from views::View:
44 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE { 44 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE {
45 canvas->FillRect(GetLocalBounds(), SK_ColorYELLOW); 45 canvas->FillRect(GetLocalBounds(), SK_ColorYELLOW);
46 base::string16 text = base::ASCIIToUTF16("LOCKED!"); 46 base::string16 text = base::ASCIIToUTF16("LOCKED!");
47 int string_width = gfx::GetStringWidth(text, font_list_); 47 int string_width = gfx::GetStringWidth(text, font_list_);
48 canvas->DrawStringRect(text, font_list_, SK_ColorRED, 48 canvas->DrawStringRect(text, font_list_, SK_ColorRED,
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 widget->GetNativeView()->SetName("LockView"); 102 widget->GetNativeView()->SetName("LockView");
103 widget->GetNativeView()->Focus(); 103 widget->GetNativeView()->Focus();
104 104
105 // TODO: it shouldn't be necessary to invoke UpdateTooltip() here. 105 // TODO: it shouldn't be necessary to invoke UpdateTooltip() here.
106 Shell::GetInstance()->tooltip_controller()->UpdateTooltip( 106 Shell::GetInstance()->tooltip_controller()->UpdateTooltip(
107 widget->GetNativeView()); 107 widget->GetNativeView());
108 } 108 }
109 109
110 } // namespace shell 110 } // namespace shell
111 } // namespace ash 111 } // namespace ash
OLDNEW
« no previous file with comments | « ash/shelf/shelf_view.cc ('k') | ash/shell/panel_window.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698