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

Side by Side Diff: chrome/browser/ui/views/frame/app_non_client_frame_view_aura.cc

Issue 10823025: Adding new maximize menu according to spec (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: git try Created 8 years, 4 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 "chrome/browser/ui/views/frame/app_non_client_frame_view_aura.h" 5 #include "chrome/browser/ui/views/frame/app_non_client_frame_view_aura.h"
6 6
7 #include "base/debug/stack_trace.h" 7 #include "base/debug/stack_trace.h"
8 #include "chrome/browser/ui/views/frame/browser_frame.h" 8 #include "chrome/browser/ui/views/frame/browser_frame.h"
9 #include "chrome/browser/ui/views/frame/browser_view.h" 9 #include "chrome/browser/ui/views/frame/browser_view.h"
10 #include "grit/generated_resources.h" // Accessibility names 10 #include "grit/generated_resources.h" // Accessibility names
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 l10n_util::GetStringUTF16(IDS_ACCNAME_CLOSE)); 62 l10n_util::GetStringUTF16(IDS_ACCNAME_CLOSE));
63 restore_button_->SetAccessibleName( 63 restore_button_->SetAccessibleName(
64 l10n_util::GetStringUTF16(IDS_ACCNAME_MAXIMIZE)); 64 l10n_util::GetStringUTF16(IDS_ACCNAME_MAXIMIZE));
65 65
66 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 66 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
67 67
68 int control_base_resource_id = owner->browser_view()->IsOffTheRecord() ? 68 int control_base_resource_id = owner->browser_view()->IsOffTheRecord() ?
69 IDR_AURA_WINDOW_HEADER_BASE_INCOGNITO_ACTIVE : 69 IDR_AURA_WINDOW_HEADER_BASE_INCOGNITO_ACTIVE :
70 IDR_AURA_WINDOW_HEADER_BASE_ACTIVE; 70 IDR_AURA_WINDOW_HEADER_BASE_ACTIVE;
71 control_base_ = rb.GetImageNamed(control_base_resource_id).ToImageSkia(); 71 control_base_ = rb.GetImageNamed(control_base_resource_id).ToImageSkia();
72
73 separator_ =
74 rb.GetImageNamed(IDR_AURA_WINDOW_FULLSCREEN_SEPARATOR).ToImageSkia();
75 shadow_ = rb.GetImageNamed(IDR_AURA_WINDOW_FULLSCREEN_SHADOW).ToImageSkia(); 72 shadow_ = rb.GetImageNamed(IDR_AURA_WINDOW_FULLSCREEN_SHADOW).ToImageSkia();
76 73
77 AddChildView(close_button_); 74 AddChildView(close_button_);
78 AddChildView(restore_button_); 75 AddChildView(restore_button_);
79 } 76 }
80 77
81 virtual ~ControlView() {} 78 virtual ~ControlView() {}
82 79
83 virtual void Layout() OVERRIDE { 80 virtual void Layout() OVERRIDE {
84 restore_button_->SetPosition(gfx::Point(kShadowStart, 0)); 81 restore_button_->SetPosition(gfx::Point(kShadowStart, 0));
(...skipping 25 matching lines...) Expand all
110 107
111 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE { 108 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE {
112 canvas->TileImageInt(*control_base_, 109 canvas->TileImageInt(*control_base_,
113 restore_button_->x(), 110 restore_button_->x(),
114 restore_button_->y(), 111 restore_button_->y(),
115 restore_button_->width() - kButtonOverlap + close_button_->width(), 112 restore_button_->width() - kButtonOverlap + close_button_->width(),
116 restore_button_->height()); 113 restore_button_->height());
117 114
118 views::View::OnPaint(canvas); 115 views::View::OnPaint(canvas);
119 116
120 // Separator overlaps the left edge of the close button.
121 canvas->DrawImageInt(*separator_,
122 close_button_->x(), 0);
123 canvas->DrawImageInt(*shadow_, 0, kShadowHeightStretch); 117 canvas->DrawImageInt(*shadow_, 0, kShadowHeightStretch);
124 } 118 }
125 119
126 virtual void ButtonPressed(views::Button* sender, 120 virtual void ButtonPressed(views::Button* sender,
127 const views::Event& event) OVERRIDE { 121 const views::Event& event) OVERRIDE {
128 if (sender == close_button_) { 122 if (sender == close_button_) {
129 owner_->Close(); 123 owner_->Close();
130 } else if (sender == restore_button_) { 124 } else if (sender == restore_button_) {
131 restore_button_->SetState(views::CustomButton::BS_NORMAL); 125 restore_button_->SetState(views::CustomButton::BS_NORMAL);
132 owner_->Restore(); 126 owner_->Restore();
(...skipping 11 matching lines...) Expand all
144 button->SetImage(views::CustomButton::BS_HOT, 138 button->SetImage(views::CustomButton::BS_HOT,
145 theme_provider->GetImageSkiaNamed(hot_image_id)); 139 theme_provider->GetImageSkiaNamed(hot_image_id));
146 button->SetImage(views::CustomButton::BS_PUSHED, 140 button->SetImage(views::CustomButton::BS_PUSHED,
147 theme_provider->GetImageSkiaNamed(pushed_image_id)); 141 theme_provider->GetImageSkiaNamed(pushed_image_id));
148 } 142 }
149 143
150 AppNonClientFrameViewAura* owner_; 144 AppNonClientFrameViewAura* owner_;
151 views::ImageButton* close_button_; 145 views::ImageButton* close_button_;
152 views::ImageButton* restore_button_; 146 views::ImageButton* restore_button_;
153 const gfx::ImageSkia* control_base_; 147 const gfx::ImageSkia* control_base_;
154 const gfx::ImageSkia* separator_;
155 const gfx::ImageSkia* shadow_; 148 const gfx::ImageSkia* shadow_;
156 149
157 DISALLOW_COPY_AND_ASSIGN(ControlView); 150 DISALLOW_COPY_AND_ASSIGN(ControlView);
158 }; 151 };
159 152
160 class AppNonClientFrameViewAura::Host : public views::MouseWatcherHost { 153 class AppNonClientFrameViewAura::Host : public views::MouseWatcherHost {
161 public: 154 public:
162 explicit Host(AppNonClientFrameViewAura* owner) : owner_(owner) {} 155 explicit Host(AppNonClientFrameViewAura* owner) : owner_(owner) {}
163 virtual ~Host() {} 156 virtual ~Host() {}
164 157
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 bool AppNonClientFrameViewAura::IsShowingControls() const { 317 bool AppNonClientFrameViewAura::IsShowingControls() const {
325 return control_widget_ && control_widget_->IsVisible(); 318 return control_widget_ && control_widget_->IsVisible();
326 } 319 }
327 320
328 void AppNonClientFrameViewAura::Restore() { 321 void AppNonClientFrameViewAura::Restore() {
329 if (control_widget_) 322 if (control_widget_)
330 control_widget_->Close(); 323 control_widget_->Close();
331 mouse_watcher_.Stop(); 324 mouse_watcher_.Stop();
332 frame()->Restore(); 325 frame()->Restore();
333 } 326 }
OLDNEW
« no previous file with comments | « ash/wm/workspace/snap_types.h ('k') | ui/resources/default_100_percent/aura/window_fullscreen_close_hover.png » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698