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

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

Issue 7057014: Variety of tweaks to View API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/glass_browser_frame_view.h" 5 #include "chrome/browser/ui/views/frame/glass_browser_frame_view.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "chrome/app/chrome_command_ids.h" 9 #include "chrome/app/chrome_command_ids.h"
10 #include "chrome/app/chrome_dll_resource.h" 10 #include "chrome/app/chrome_dll_resource.h"
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 // position to move this tab strip left when maximized. Also, we can render 125 // position to move this tab strip left when maximized. Also, we can render
126 // a tab strip until the left end of this window without considering the size 126 // a tab strip until the left end of this window without considering the size
127 // of window controls in RTL languages. 127 // of window controls in RTL languages.
128 if (base::i18n::IsRTL()) { 128 if (base::i18n::IsRTL()) {
129 if (!browser_view_->ShouldShowOffTheRecordAvatar() && frame_->IsMaximized()) 129 if (!browser_view_->ShouldShowOffTheRecordAvatar() && frame_->IsMaximized())
130 tabstrip_x += otr_avatar_bounds_.x(); 130 tabstrip_x += otr_avatar_bounds_.x();
131 minimize_button_offset = width(); 131 minimize_button_offset = width();
132 } 132 }
133 int maximized_spacing = 133 int maximized_spacing =
134 kNewTabCaptionMaximizedSpacing + 134 kNewTabCaptionMaximizedSpacing +
135 (show_profile_button() && profile_button_->IsVisible() ? 135 (show_profile_button() && profile_button_->visible() ?
136 profile_button_->GetPreferredSize().width() + 136 profile_button_->GetPreferredSize().width() +
137 ProfileMenuButton::kProfileTagHorizontalSpacing : 0); 137 ProfileMenuButton::kProfileTagHorizontalSpacing : 0);
138 int tabstrip_width = minimize_button_offset - tabstrip_x - 138 int tabstrip_width = minimize_button_offset - tabstrip_x -
139 (frame_->IsMaximized() ? 139 (frame_->IsMaximized() ?
140 maximized_spacing : kNewTabCaptionRestoredSpacing); 140 maximized_spacing : kNewTabCaptionRestoredSpacing);
141 return gfx::Rect(tabstrip_x, GetHorizontalTabStripVerticalOffset(false), 141 return gfx::Rect(tabstrip_x, GetHorizontalTabStripVerticalOffset(false),
142 std::max(0, tabstrip_width), 142 std::max(0, tabstrip_width),
143 tabstrip->GetPreferredSize().height()); 143 tabstrip->GetPreferredSize().height());
144 } 144 }
145 145
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 int nonclient_border_thickness = NonClientBorderThickness(); 204 int nonclient_border_thickness = NonClientBorderThickness();
205 if (gfx::Rect(nonclient_border_thickness, GetSystemMetrics(SM_CXSIZEFRAME), 205 if (gfx::Rect(nonclient_border_thickness, GetSystemMetrics(SM_CXSIZEFRAME),
206 GetSystemMetrics(SM_CXSMICON), 206 GetSystemMetrics(SM_CXSMICON),
207 GetSystemMetrics(SM_CYSMICON)).Contains(point)) 207 GetSystemMetrics(SM_CYSMICON)).Contains(point))
208 return (frame_component == HTCLIENT) ? HTCLIENT : HTSYSMENU; 208 return (frame_component == HTCLIENT) ? HTCLIENT : HTSYSMENU;
209 209
210 if (frame_component != HTNOWHERE) 210 if (frame_component != HTNOWHERE)
211 return frame_component; 211 return frame_component;
212 212
213 // See if the point is within the profile menu button. 213 // See if the point is within the profile menu button.
214 if (show_profile_button() && profile_button_->IsVisible() && 214 if (show_profile_button() && profile_button_->visible() &&
215 profile_button_->GetMirroredBounds().Contains(point)) 215 profile_button_->GetMirroredBounds().Contains(point))
216 return HTCLIENT; 216 return HTCLIENT;
217 217
218 int frame_border_thickness = FrameBorderThickness(); 218 int frame_border_thickness = FrameBorderThickness();
219 int window_component = GetHTComponentForFrame(point, frame_border_thickness, 219 int window_component = GetHTComponentForFrame(point, frame_border_thickness,
220 nonclient_border_thickness, frame_border_thickness, 220 nonclient_border_thickness, frame_border_thickness,
221 kResizeAreaCornerSize - frame_border_thickness, 221 kResizeAreaCornerSize - frame_border_thickness,
222 frame_->window_delegate()->CanResize()); 222 frame_->window_delegate()->CanResize());
223 // Fall back to the caption if no other component matches. 223 // Fall back to the caption if no other component matches.
224 return (window_component == HTNOWHERE) ? HTCAPTION : window_component; 224 return (window_component == HTNOWHERE) ? HTCAPTION : window_component;
(...skipping 16 matching lines...) Expand all
241 void GlassBrowserFrameView::Layout() { 241 void GlassBrowserFrameView::Layout() {
242 LayoutOTRAvatar(); 242 LayoutOTRAvatar();
243 LayoutClientView(); 243 LayoutClientView();
244 LayoutProfileTag(); 244 LayoutProfileTag();
245 } 245 }
246 246
247 bool GlassBrowserFrameView::HitTest(const gfx::Point& l) const { 247 bool GlassBrowserFrameView::HitTest(const gfx::Point& l) const {
248 // The ProfileMenuButton intrudes into the client area when the window is 248 // The ProfileMenuButton intrudes into the client area when the window is
249 // maximized. 249 // maximized.
250 if (frame_->IsMaximized() && show_profile_button() && 250 if (frame_->IsMaximized() && show_profile_button() &&
251 profile_button_->IsVisible() && 251 profile_button_->visible() &&
252 profile_button_->GetMirroredBounds().Contains(l)) { 252 profile_button_->GetMirroredBounds().Contains(l)) {
253 return true; 253 return true;
254 } else { 254 } else {
255 return !frame_->client_view()->bounds().Contains(l); 255 return !frame_->client_view()->bounds().Contains(l);
256 } 256 }
257 } 257 }
258 258
259 /////////////////////////////////////////////////////////////////////////////// 259 ///////////////////////////////////////////////////////////////////////////////
260 // GlassBrowserFrameView, private: 260 // GlassBrowserFrameView, private:
261 261
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
609 static bool initialized = false; 609 static bool initialized = false;
610 if (!initialized) { 610 if (!initialized) {
611 ResourceBundle &rb = ResourceBundle::GetSharedInstance(); 611 ResourceBundle &rb = ResourceBundle::GetSharedInstance();
612 for (int i = 0; i < kThrobberIconCount; ++i) { 612 for (int i = 0; i < kThrobberIconCount; ++i) {
613 throbber_icons_[i] = rb.LoadThemeIcon(IDI_THROBBER_01 + i); 613 throbber_icons_[i] = rb.LoadThemeIcon(IDI_THROBBER_01 + i);
614 DCHECK(throbber_icons_[i]); 614 DCHECK(throbber_icons_[i]);
615 } 615 }
616 initialized = true; 616 initialized = true;
617 } 617 }
618 } 618 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/frame/browser_view_layout.cc ('k') | chrome/browser/ui/views/frame/opaque_browser_frame_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698