| OLD | NEW |
| 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/old_frames/simple_xp_frame.h" | 5 #include "chrome/browser/views/old_frames/simple_xp_frame.h" |
| 6 | 6 |
| 7 #include "chrome/app/theme/theme_resources.h" | 7 #include "chrome/app/theme/theme_resources.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "chrome/browser/browser.h" | 9 #include "chrome/browser/browser.h" |
| 10 #include "chrome/browser/profile.h" | 10 #include "chrome/browser/profile.h" |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 return SkBitmap(); | 188 return SkBitmap(); |
| 189 } | 189 } |
| 190 | 190 |
| 191 void SimpleXPFrameTitleBar::RunMenu(ChromeViews::View* source, | 191 void SimpleXPFrameTitleBar::RunMenu(ChromeViews::View* source, |
| 192 const CPoint& pt, HWND hwnd) { | 192 const CPoint& pt, HWND hwnd) { |
| 193 // Make sure we calculate the menu position based on the display bounds of | 193 // Make sure we calculate the menu position based on the display bounds of |
| 194 // the menu button. The display bounds are different than the actual bounds | 194 // the menu button. The display bounds are different than the actual bounds |
| 195 // when the UI layout is RTL and hence we use the mirroring transformation | 195 // when the UI layout is RTL and hence we use the mirroring transformation |
| 196 // flag. We also adjust the menu position because RTL menus use a different | 196 // flag. We also adjust the menu position because RTL menus use a different |
| 197 // anchor point. | 197 // anchor point. |
| 198 CPoint p(menu_button_->GetX(APPLY_MIRRORING_TRANSFORMATION), | 198 gfx::Point p(menu_button_->GetX(APPLY_MIRRORING_TRANSFORMATION), |
| 199 menu_button_->y() + menu_button_->height()); | 199 menu_button_->y() + menu_button_->height()); |
| 200 | 200 |
| 201 if (UILayoutIsRightToLeft()) | 201 if (UILayoutIsRightToLeft()) |
| 202 p.x += menu_button_->width(); | 202 p.set_x(p.x() + menu_button_->width()); |
| 203 View::ConvertPointToScreen(this, &p); | 203 View::ConvertPointToScreen(this, &p); |
| 204 parent_->RunMenu(p, hwnd); | 204 parent_->RunMenu(p.ToPOINT(), hwnd); |
| 205 } | 205 } |
| 206 | 206 |
| 207 void SimpleXPFrameTitleBar::Layout() { | 207 void SimpleXPFrameTitleBar::Layout() { |
| 208 CSize s; | 208 CSize s; |
| 209 menu_button_->GetPreferredSize(&s); | 209 menu_button_->GetPreferredSize(&s); |
| 210 menu_button_->SetBounds(kFavIconMargin, (height() - s.cy) / 2, | 210 menu_button_->SetBounds(kFavIconMargin, (height() - s.cy) / 2, |
| 211 s.cx, s.cy); | 211 s.cx, s.cy); |
| 212 menu_button_->Layout(); | 212 menu_button_->Layout(); |
| 213 label_->SetBounds(menu_button_->x() + menu_button_->width() + | 213 label_->SetBounds(menu_button_->x() + menu_button_->width() + |
| 214 kFavIconPadding, kLabelVerticalOffset, | 214 kFavIconPadding, kLabelVerticalOffset, |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 1); | 335 1); |
| 336 location_bar_->SetVisible(true); | 336 location_bar_->SetVisible(true); |
| 337 location_bar_->Layout(); | 337 location_bar_->Layout(); |
| 338 } else { | 338 } else { |
| 339 location_bar_->SetVisible(false); | 339 location_bar_->SetVisible(false); |
| 340 } | 340 } |
| 341 } | 341 } |
| 342 | 342 |
| 343 LRESULT SimpleXPFrame::OnNCHitTest(const CPoint& pt) { | 343 LRESULT SimpleXPFrame::OnNCHitTest(const CPoint& pt) { |
| 344 if (IsTitleBarVisible()) { | 344 if (IsTitleBarVisible()) { |
| 345 CPoint p(pt); | 345 gfx::Point p(pt); |
| 346 ChromeViews::View::ConvertPointToView(NULL, title_bar_, &p); | 346 ChromeViews::View::ConvertPointToView(NULL, title_bar_, &p); |
| 347 if (!title_bar_->WillHandleMouseEvent(p.x, p.y) && | 347 if (!title_bar_->WillHandleMouseEvent(p.x(), p.y()) && |
| 348 p.x >= 0 && p.y >= kTopResizeBarHeight && | 348 p.x() >= 0 && p.y() >= kTopResizeBarHeight && |
| 349 p.x < title_bar_->width() && | 349 p.x() < title_bar_->width() && |
| 350 p.y < title_bar_->height()) { | 350 p.y() < title_bar_->height()) { |
| 351 return HTCAPTION; | 351 return HTCAPTION; |
| 352 } | 352 } |
| 353 } | 353 } |
| 354 return XPFrame::OnNCHitTest(pt); | 354 return XPFrame::OnNCHitTest(pt); |
| 355 } | 355 } |
| 356 | 356 |
| 357 void SimpleXPFrame::SetWindowTitle(const std::wstring& title) { | 357 void SimpleXPFrame::SetWindowTitle(const std::wstring& title) { |
| 358 if (IsTitleBarVisible()) | 358 if (IsTitleBarVisible()) |
| 359 title_bar_->SetWindowTitle(title); | 359 title_bar_->SetWindowTitle(title); |
| 360 XPFrame::SetWindowTitle(title); | 360 XPFrame::SetWindowTitle(title); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 location_bar_->Update(NULL); | 394 location_bar_->Update(NULL); |
| 395 } | 395 } |
| 396 | 396 |
| 397 TabContents* SimpleXPFrame::GetTabContents() { | 397 TabContents* SimpleXPFrame::GetTabContents() { |
| 398 return GetCurrentContents(); | 398 return GetCurrentContents(); |
| 399 } | 399 } |
| 400 | 400 |
| 401 void SimpleXPFrame::OnInputInProgress(bool in_progress) { | 401 void SimpleXPFrame::OnInputInProgress(bool in_progress) { |
| 402 } | 402 } |
| 403 | 403 |
| OLD | NEW |