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

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

Issue 10389217: Aura: Desktop aura is now default on non-chromeos linux builds. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 | « build/common.gypi ('k') | no next file » | 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 "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 "ash/wm/workspace/frame_maximize_button.h"
8 #include "base/debug/stack_trace.h" 7 #include "base/debug/stack_trace.h"
9 #include "chrome/browser/ui/views/frame/browser_frame.h" 8 #include "chrome/browser/ui/views/frame/browser_frame.h"
10 #include "chrome/browser/ui/views/frame/browser_view.h" 9 #include "chrome/browser/ui/views/frame/browser_view.h"
11 #include "grit/generated_resources.h" // Accessibility names 10 #include "grit/generated_resources.h" // Accessibility names
12 #include "grit/theme_resources.h" 11 #include "grit/theme_resources.h"
13 #include "grit/theme_resources_standard.h" 12 #include "grit/theme_resources_standard.h"
14 #include "grit/ui_resources.h" 13 #include "grit/ui_resources.h"
15 #include "grit/ui_resources_standard.h" 14 #include "grit/ui_resources_standard.h"
16 #include "ui/aura/window.h" 15 #include "ui/aura/window.h"
17 #include "ui/base/animation/slide_animation.h" 16 #include "ui/base/animation/slide_animation.h"
18 #include "ui/base/hit_test.h" 17 #include "ui/base/hit_test.h"
19 #include "ui/base/l10n/l10n_util.h" 18 #include "ui/base/l10n/l10n_util.h"
20 #include "ui/base/resource/resource_bundle.h" 19 #include "ui/base/resource/resource_bundle.h"
21 #include "ui/base/theme_provider.h" 20 #include "ui/base/theme_provider.h"
22 #include "ui/compositor/layer.h" 21 #include "ui/compositor/layer.h"
23 #include "ui/compositor/scoped_layer_animation_settings.h" 22 #include "ui/compositor/scoped_layer_animation_settings.h"
24 #include "ui/gfx/canvas.h" 23 #include "ui/gfx/canvas.h"
25 #include "ui/gfx/image/image.h" 24 #include "ui/gfx/image/image.h"
26 #include "ui/gfx/point.h" 25 #include "ui/gfx/point.h"
27 #include "ui/gfx/rect.h" 26 #include "ui/gfx/rect.h"
28 #include "ui/gfx/size.h" 27 #include "ui/gfx/size.h"
29 #include "ui/views/controls/button/image_button.h" 28 #include "ui/views/controls/button/image_button.h"
30 #include "ui/views/widget/widget.h" 29 #include "ui/views/widget/widget.h"
31 #include "ui/views/window/non_client_view.h" 30 #include "ui/views/window/non_client_view.h"
32 31
32 #if defined(USE_ASH)
33 #include "ash/wm/workspace/frame_maximize_button.h"
34 #endif
35
33 namespace { 36 namespace {
34 // The number of pixels to use as a hover zone at the top of the screen. 37 // The number of pixels to use as a hover zone at the top of the screen.
35 const int kTopMargin = 1; 38 const int kTopMargin = 1;
36 // How long the hover animation takes if uninterrupted. 39 // How long the hover animation takes if uninterrupted.
37 const int kHoverFadeDurationMs = 130; 40 const int kHoverFadeDurationMs = 130;
38 // The number of pixels within the shadow to draw the buttons. 41 // The number of pixels within the shadow to draw the buttons.
39 const int kShadowStart = 16; 42 const int kShadowStart = 16;
40 // The size and close buttons are designed to overlap. 43 // The size and close buttons are designed to overlap.
41 const int kButtonOverlap = 1; 44 const int kButtonOverlap = 1;
42 45
43 // TODO(pkotwicz): Remove these constants once the IDR_AURA_FULLSCREEN_SHADOW 46 // TODO(pkotwicz): Remove these constants once the IDR_AURA_FULLSCREEN_SHADOW
44 // resource is updated. 47 // resource is updated.
45 const int kShadowHeightStretch = -1; 48 const int kShadowHeightStretch = -1;
46 } 49 }
47 50
48 class AppNonClientFrameViewAura::ControlView 51 class AppNonClientFrameViewAura::ControlView
49 : public views::View, public views::ButtonListener { 52 : public views::View, public views::ButtonListener {
50 public: 53 public:
51 explicit ControlView(AppNonClientFrameViewAura* owner) : 54 explicit ControlView(AppNonClientFrameViewAura* owner) :
52 owner_(owner), 55 owner_(owner),
53 close_button_(new views::ImageButton(this)), 56 close_button_(new views::ImageButton(this)),
54 restore_button_(new ash::FrameMaximizeButton(this, owner_)) { 57 #if defined(USE_ASH)
58 restore_button_(new ash::FrameMaximizeButton(this, owner_))
59 #else
60 restore_button_(new views::ImageButton(this))
61 #endif
62 {
55 close_button_->SetAccessibleName( 63 close_button_->SetAccessibleName(
56 l10n_util::GetStringUTF16(IDS_ACCNAME_CLOSE)); 64 l10n_util::GetStringUTF16(IDS_ACCNAME_CLOSE));
57 restore_button_->SetAccessibleName( 65 restore_button_->SetAccessibleName(
58 l10n_util::GetStringUTF16(IDS_ACCNAME_MAXIMIZE)); 66 l10n_util::GetStringUTF16(IDS_ACCNAME_MAXIMIZE));
59 67
60 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 68 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
61 69
62 int control_base_resource_id = owner->browser_view()->IsOffTheRecord() ? 70 int control_base_resource_id = owner->browser_view()->IsOffTheRecord() ?
63 IDR_AURA_WINDOW_HEADER_BASE_INCOGNITO_ACTIVE : 71 IDR_AURA_WINDOW_HEADER_BASE_INCOGNITO_ACTIVE :
64 IDR_AURA_WINDOW_HEADER_BASE_ACTIVE; 72 IDR_AURA_WINDOW_HEADER_BASE_ACTIVE;
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 bool AppNonClientFrameViewAura::IsShowingControls() const { 312 bool AppNonClientFrameViewAura::IsShowingControls() const {
305 return control_widget_ && control_widget_->IsVisible(); 313 return control_widget_ && control_widget_->IsVisible();
306 } 314 }
307 315
308 void AppNonClientFrameViewAura::Restore() { 316 void AppNonClientFrameViewAura::Restore() {
309 if (control_widget_) 317 if (control_widget_)
310 control_widget_->Close(); 318 control_widget_->Close();
311 mouse_watcher_.Stop(); 319 mouse_watcher_.Stop();
312 frame()->Restore(); 320 frame()->Restore();
313 } 321 }
OLDNEW
« no previous file with comments | « build/common.gypi ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698