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

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

Issue 9630002: Ash: Remove compact window mode. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: OpaqueBrowserFrameView, MultipleWindowIndicatorButton Created 8 years, 9 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
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/browser_frame_aura.h" 5 #include "chrome/browser/ui/views/frame/browser_frame_aura.h"
6 6
7 #include "ash/ash_switches.h"
8 #include "ash/shell.h"
9 #include "base/command_line.h"
10 #include "chrome/browser/chromeos/status/status_area_view.h"
11 #include "chrome/browser/ui/views/ash/chrome_shell_delegate.h"
12 #include "chrome/browser/ui/views/frame/browser_view.h" 7 #include "chrome/browser/ui/views/frame/browser_view.h"
13 #include "ui/aura/client/aura_constants.h" 8 #include "ui/aura/client/aura_constants.h"
14 #include "ui/aura/window.h" 9 #include "ui/aura/window.h"
15 #include "ui/aura/window_observer.h" 10 #include "ui/aura/window_observer.h"
16 #include "ui/gfx/font.h" 11 #include "ui/gfx/font.h"
17 #include "ui/views/background.h"
18
19 namespace {
20
21 ////////////////////////////////////////////////////////////////////////////////
22 // StatusAreaBoundsWatcher
23
24 class StatusAreaBoundsWatcher : public aura::WindowObserver {
25 public:
26 explicit StatusAreaBoundsWatcher(BrowserFrame* frame)
27 : frame_(frame),
28 status_area_window_(NULL) {
29 StartWatch();
30 }
31
32 virtual ~StatusAreaBoundsWatcher() {
33 StopWatch();
34 }
35
36 private:
37 void StartWatch() {
38 DCHECK(ChromeShellDelegate::instance());
39
40 StatusAreaView* status_area =
41 ChromeShellDelegate::instance()->GetStatusArea();
42 if (!status_area)
43 return;
44
45 StopWatch();
46 status_area_window_ = status_area->GetWidget()->GetNativeWindow();
47 status_area_window_->AddObserver(this);
48 }
49
50 void StopWatch() {
51 if (status_area_window_) {
52 status_area_window_->RemoveObserver(this);
53 status_area_window_ = NULL;
54 }
55 }
56
57 // Overridden from aura::WindowObserver:
58 virtual void OnWindowBoundsChanged(aura::Window* window,
59 const gfx::Rect& bounds) OVERRIDE {
60 DCHECK(window == status_area_window_);
61
62 // Triggers frame layout when the bounds of status area changed.
63 frame_->TabStripDisplayModeChanged();
64 }
65
66 virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE {
67 DCHECK(window == status_area_window_);
68 status_area_window_ = NULL;
69 }
70
71 BrowserFrame* frame_;
72 aura::Window* status_area_window_;
73
74 DISALLOW_COPY_AND_ASSIGN(StatusAreaBoundsWatcher);
75 };
76
77 } // namespace
78 12
79 //////////////////////////////////////////////////////////////////////////////// 13 ////////////////////////////////////////////////////////////////////////////////
80 // BrowserFrameAura::WindowPropertyWatcher 14 // BrowserFrameAura::WindowPropertyWatcher
81 15
82 class BrowserFrameAura::WindowPropertyWatcher : public aura::WindowObserver { 16 class BrowserFrameAura::WindowPropertyWatcher : public aura::WindowObserver {
83 public: 17 public:
84 explicit WindowPropertyWatcher(BrowserFrameAura* browser_frame_aura, 18 explicit WindowPropertyWatcher(BrowserFrameAura* browser_frame_aura,
85 BrowserFrame* browser_frame) 19 BrowserFrame* browser_frame)
86 : browser_frame_aura_(browser_frame_aura), 20 : browser_frame_aura_(browser_frame_aura),
87 browser_frame_(browser_frame) {} 21 browser_frame_(browser_frame) {}
(...skipping 10 matching lines...) Expand all
98 browser_frame_->non_client_view()->UpdateFrame(); 32 browser_frame_->non_client_view()->UpdateFrame();
99 33
100 // When migrating from regular ChromeOS to Aura, windows can have saved 34 // When migrating from regular ChromeOS to Aura, windows can have saved
101 // restore bounds that are exactly equal to the maximized bounds. Thus when 35 // restore bounds that are exactly equal to the maximized bounds. Thus when
102 // you hit maximize, there is no resize and the layout doesn't get 36 // you hit maximize, there is no resize and the layout doesn't get
103 // refreshed. This can also theoretically happen if a user drags a window to 37 // refreshed. This can also theoretically happen if a user drags a window to
104 // 0,0 then resizes it to fill the workspace, then hits maximize. We need 38 // 0,0 then resizes it to fill the workspace, then hits maximize. We need
105 // to force a layout on show state changes. crbug.com/108073 39 // to force a layout on show state changes. crbug.com/108073
106 if (browser_frame_->non_client_view()) 40 if (browser_frame_->non_client_view())
107 browser_frame_->non_client_view()->Layout(); 41 browser_frame_->non_client_view()->Layout();
108
109 // Watch for status area bounds change for maximized browser window in Aura
110 // compact mode.
111 if (ash::Shell::GetInstance()->IsWindowModeCompact() &&
112 browser_frame_aura_->IsMaximized())
113 status_area_watcher_.reset(new StatusAreaBoundsWatcher(browser_frame_));
114 else
115 status_area_watcher_.reset();
116 } 42 }
117 43
118 private: 44 private:
119 BrowserFrameAura* browser_frame_aura_; 45 BrowserFrameAura* browser_frame_aura_;
120 BrowserFrame* browser_frame_; 46 BrowserFrame* browser_frame_;
121 scoped_ptr<StatusAreaBoundsWatcher> status_area_watcher_;
122 47
123 DISALLOW_COPY_AND_ASSIGN(WindowPropertyWatcher); 48 DISALLOW_COPY_AND_ASSIGN(WindowPropertyWatcher);
124 }; 49 };
125 50
126 /////////////////////////////////////////////////////////////////////////////// 51 ///////////////////////////////////////////////////////////////////////////////
127 // BrowserFrameAura, public: 52 // BrowserFrameAura, public:
128 53
129 BrowserFrameAura::BrowserFrameAura(BrowserFrame* browser_frame, 54 BrowserFrameAura::BrowserFrameAura(BrowserFrame* browser_frame,
130 BrowserView* browser_view) 55 BrowserView* browser_view)
131 : views::NativeWidgetAura(browser_frame), 56 : views::NativeWidgetAura(browser_frame),
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 102
178 //////////////////////////////////////////////////////////////////////////////// 103 ////////////////////////////////////////////////////////////////////////////////
179 // NativeBrowserFrame, public: 104 // NativeBrowserFrame, public:
180 105
181 // static 106 // static
182 NativeBrowserFrame* NativeBrowserFrame::CreateNativeBrowserFrame( 107 NativeBrowserFrame* NativeBrowserFrame::CreateNativeBrowserFrame(
183 BrowserFrame* browser_frame, 108 BrowserFrame* browser_frame,
184 BrowserView* browser_view) { 109 BrowserView* browser_view) {
185 return new BrowserFrameAura(browser_frame, browser_view); 110 return new BrowserFrameAura(browser_frame, browser_view);
186 } 111 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698