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

Side by Side Diff: chrome/browser/views/frame/aero_glass_frame.cc

Issue 20011: Improved OTR avatar and popup window rendering. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 10 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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/views/frame/aero_glass_frame.h" 5 #include "chrome/browser/views/frame/aero_glass_frame.h"
6 6
7 #include <dwmapi.h> 7 #include <dwmapi.h>
8 8
9 #include "chrome/app/theme/theme_resources.h" 9 #include "chrome/app/theme/theme_resources.h"
10 #include "chrome/browser/browser_list.h" 10 #include "chrome/browser/browser_list.h"
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 frame_initialized_ = true; 136 frame_initialized_ = true;
137 } 137 }
138 browser_view_->ActivationChanged(!!active); 138 browser_view_->ActivationChanged(!!active);
139 SetMsgHandled(false); 139 SetMsgHandled(false);
140 return TRUE; 140 return TRUE;
141 } 141 }
142 142
143 LRESULT AeroGlassFrame::OnNCCalcSize(BOOL mode, LPARAM l_param) { 143 LRESULT AeroGlassFrame::OnNCCalcSize(BOOL mode, LPARAM l_param) {
144 // By default the client side is set to the window size which is what 144 // By default the client side is set to the window size which is what
145 // we want. 145 // we want.
146 if (browser_view_->IsToolbarVisible() && mode == TRUE) { 146 if (browser_view_->IsTabStripVisible() && mode == TRUE) {
147 // To be on the safe side and avoid side-effects, we only adjust the client 147 // Calculate new NCCALCSIZE_PARAMS based on custom NCA inset.
148 // size to non-standard values when we must - i.e. when we're showing a 148 NCCALCSIZE_PARAMS* params = reinterpret_cast<NCCALCSIZE_PARAMS*>(l_param);
149 // TabStrip.
150 if (browser_view_->IsTabStripVisible()) {
151 // Calculate new NCCALCSIZE_PARAMS based on custom NCA inset.
152 NCCALCSIZE_PARAMS* params = reinterpret_cast<NCCALCSIZE_PARAMS*>(l_param);
153 149
154 // Hack necessary to stop black background flicker, we cut out 150 // Hack necessary to stop black background flicker, we cut out
155 // resizeborder here to save us from having to do too much 151 // resizeborder here to save us from having to do too much
156 // addition and subtraction in Layout(). We don't cut off the 152 // addition and subtraction in Layout(). We don't cut off the
157 // top + titlebar as that prevents the window controls from 153 // top + titlebar as that prevents the window controls from
158 // highlighting. 154 // highlighting.
159 params->rgrc[0].left += 155 params->rgrc[0].left +=
160 (kResizeBorder - kWindowHorizontalClientEdgeWidth); 156 (kResizeBorder - kWindowHorizontalClientEdgeWidth);
161 params->rgrc[0].right -= 157 params->rgrc[0].right -=
162 (kResizeBorder - kWindowHorizontalClientEdgeWidth); 158 (kResizeBorder - kWindowHorizontalClientEdgeWidth);
163 params->rgrc[0].bottom -= 159 params->rgrc[0].bottom -=
164 (kResizeBorder - kWindowBottomClientEdgeHeight); 160 (kResizeBorder - kWindowBottomClientEdgeHeight);
165 161
166 SetMsgHandled(TRUE); 162 SetMsgHandled(TRUE);
167 } else {
168 // We don't adjust the client size for detached popups, so we need to
169 // tell Windows we didn't handle the message here so that it doesn't
170 // screw up the non-client area.
171 SetMsgHandled(FALSE);
172 }
173 163
174 // We need to reset the frame, as Vista resets it whenever it changes 164 // We need to reset the frame, as Vista resets it whenever it changes
175 // composition modes (and NCCALCSIZE is the closest thing we get to 165 // composition modes (and NCCALCSIZE is the closest thing we get to
176 // a reliable message about the change). 166 // a reliable message about the change).
177 UpdateDWMFrame(); 167 UpdateDWMFrame();
178 168
179 return 0; 169 return 0;
180 } 170 }
181 SetMsgHandled(FALSE); 171 SetMsgHandled(FALSE);
182 return 0; 172 return 0;
(...skipping 16 matching lines...) Expand all
199 } 189 }
200 190
201 /////////////////////////////////////////////////////////////////////////////// 191 ///////////////////////////////////////////////////////////////////////////////
202 // AeroGlassFrame, private: 192 // AeroGlassFrame, private:
203 193
204 void AeroGlassFrame::UpdateDWMFrame() { 194 void AeroGlassFrame::UpdateDWMFrame() {
205 // Nothing to do yet. 195 // Nothing to do yet.
206 if (!client_view()) 196 if (!client_view())
207 return; 197 return;
208 198
209 // We only adjust the DWM's glass rendering when we're a browser window or a 199 // We only adjust the DWM's glass rendering when we're a browser window.
210 // detached popup. App windows get the standard client edge. 200 // Popups and app windows get the standard client edge.
211 if (browser_view_->IsTabStripVisible() || 201 if (browser_view_->IsTabStripVisible()) {
212 browser_view_->IsToolbarVisible()) {
213 // By default, we just want to adjust the glass by the width of the inner 202 // By default, we just want to adjust the glass by the width of the inner
214 // bevel that aero renders to demarcate the client area. We supply our own 203 // bevel that aero renders to demarcate the client area. We supply our own
215 // client edge for the browser window and detached popups, so we don't want 204 // client edge for the browser window and detached popups, so we don't want
216 // to show the default one. 205 // to show the default one.
217 int client_edge_left_width = kWindowHorizontalClientEdgeWidth + 1; 206 int client_edge_left_width = kWindowHorizontalClientEdgeWidth + 1;
218 int client_edge_right_width = kWindowHorizontalClientEdgeWidth + 1; 207 int client_edge_right_width = kWindowHorizontalClientEdgeWidth + 1;
219 int client_edge_bottom_height = kWindowBottomClientEdgeHeight + 1; 208 int client_edge_bottom_height = kWindowBottomClientEdgeHeight + 1;
220 int client_edge_top_height = kWindowBottomClientEdgeHeight; 209 int client_edge_top_height = kWindowBottomClientEdgeHeight;
221 if (browser_view_->IsTabStripVisible()) { 210 if (browser_view_->IsTabStripVisible()) {
222 gfx::Rect tabstrip_bounds = 211 gfx::Rect tabstrip_bounds =
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 static bool initialized = false; 254 static bool initialized = false;
266 if (!initialized) { 255 if (!initialized) {
267 ResourceBundle &rb = ResourceBundle::GetSharedInstance(); 256 ResourceBundle &rb = ResourceBundle::GetSharedInstance();
268 for (int i = 0; i < kThrobberIconCount; ++i) { 257 for (int i = 0; i < kThrobberIconCount; ++i) {
269 throbber_icons_[i] = rb.LoadThemeIcon(IDR_THROBBER_01 + i); 258 throbber_icons_[i] = rb.LoadThemeIcon(IDR_THROBBER_01 + i);
270 DCHECK(throbber_icons_[i]); 259 DCHECK(throbber_icons_[i]);
271 } 260 }
272 initialized = true; 261 initialized = true;
273 } 262 }
274 } 263 }
OLDNEW
« no previous file with comments | « chrome/browser/autocomplete/autocomplete_popup.cc ('k') | chrome/browser/views/frame/aero_glass_non_client_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698