| OLD | NEW |
| 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_view.h" | 5 #include "chrome/browser/ui/views/frame/browser_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 public: | 245 public: |
| 246 ResizeCorner() { | 246 ResizeCorner() { |
| 247 EnableCanvasFlippingForRTLUI(true); | 247 EnableCanvasFlippingForRTLUI(true); |
| 248 } | 248 } |
| 249 | 249 |
| 250 virtual void OnPaint(gfx::Canvas* canvas) { | 250 virtual void OnPaint(gfx::Canvas* canvas) { |
| 251 views::Widget* widget = GetWidget(); | 251 views::Widget* widget = GetWidget(); |
| 252 if (!widget || (widget->IsMaximized() || widget->IsFullscreen())) | 252 if (!widget || (widget->IsMaximized() || widget->IsFullscreen())) |
| 253 return; | 253 return; |
| 254 | 254 |
| 255 SkBitmap* bitmap = ui::ResourceBundle::GetSharedInstance().GetBitmapNamed( | 255 gfx::ImageSkia* image = ui::ResourceBundle::GetSharedInstance(). |
| 256 IDR_TEXTAREA_RESIZER); | 256 GetImageSkiaNamed(IDR_TEXTAREA_RESIZER); |
| 257 bitmap->buildMipMap(false); | 257 canvas->DrawBitmapInt(*image, width() - image->width(), |
| 258 canvas->DrawBitmapInt(*bitmap, width() - bitmap->width(), | 258 height() - image->height()); |
| 259 height() - bitmap->height()); | |
| 260 } | 259 } |
| 261 | 260 |
| 262 static gfx::Size GetSize() { | 261 static gfx::Size GetSize() { |
| 263 // This is disabled until we find what makes us slower when we let | 262 // This is disabled until we find what makes us slower when we let |
| 264 // WebKit know that we have a resizer rect... | 263 // WebKit know that we have a resizer rect... |
| 265 // int scrollbar_thickness = gfx::scrollbar_size(); | 264 // int scrollbar_thickness = gfx::scrollbar_size(); |
| 266 // return gfx::Size(scrollbar_thickness, scrollbar_thickness); | 265 // return gfx::Size(scrollbar_thickness, scrollbar_thickness); |
| 267 return gfx::Size(); | 266 return gfx::Size(); |
| 268 } | 267 } |
| 269 | 268 |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 506 } | 505 } |
| 507 | 506 |
| 508 WebContents* BrowserView::GetSelectedWebContents() const { | 507 WebContents* BrowserView::GetSelectedWebContents() const { |
| 509 return browser_->GetSelectedWebContents(); | 508 return browser_->GetSelectedWebContents(); |
| 510 } | 509 } |
| 511 | 510 |
| 512 TabContentsWrapper* BrowserView::GetSelectedTabContentsWrapper() const { | 511 TabContentsWrapper* BrowserView::GetSelectedTabContentsWrapper() const { |
| 513 return browser_->GetSelectedTabContentsWrapper(); | 512 return browser_->GetSelectedTabContentsWrapper(); |
| 514 } | 513 } |
| 515 | 514 |
| 516 SkBitmap BrowserView::GetOTRAvatarIcon() const { | 515 gfx::ImageSkia BrowserView::GetOTRAvatarIcon() const { |
| 517 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 516 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
| 518 const SkBitmap* otr_avatar = | 517 const gfx::ImageSkia* otr_avatar = |
| 519 rb.GetNativeImageNamed(IDR_OTR_ICON).ToSkBitmap(); | 518 rb.GetNativeImageNamed(IDR_OTR_ICON).ToImageSkia(); |
| 520 return *otr_avatar; | 519 return *otr_avatar; |
| 521 } | 520 } |
| 522 | 521 |
| 523 bool BrowserView::IsPositionInWindowCaption(const gfx::Point& point) { | 522 bool BrowserView::IsPositionInWindowCaption(const gfx::Point& point) { |
| 524 return GetBrowserViewLayout()->IsPositionInWindowCaption(point); | 523 return GetBrowserViewLayout()->IsPositionInWindowCaption(point); |
| 525 } | 524 } |
| 526 | 525 |
| 527 /////////////////////////////////////////////////////////////////////////////// | 526 /////////////////////////////////////////////////////////////////////////////// |
| 528 // BrowserView, BrowserWindow implementation: | 527 // BrowserView, BrowserWindow implementation: |
| 529 | 528 |
| (...skipping 892 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1422 bool BrowserView::ShouldShowWindowTitle() const { | 1421 bool BrowserView::ShouldShowWindowTitle() const { |
| 1423 #if defined(USE_ASH) | 1422 #if defined(USE_ASH) |
| 1424 // For Ash only, app host windows do not show an icon, crbug.com/119411. | 1423 // For Ash only, app host windows do not show an icon, crbug.com/119411. |
| 1425 // Child windows (e.g. extension panels, popups) do show an icon. | 1424 // Child windows (e.g. extension panels, popups) do show an icon. |
| 1426 if (browser_->is_app() && browser_->app_type() == Browser::APP_TYPE_HOST) | 1425 if (browser_->is_app() && browser_->app_type() == Browser::APP_TYPE_HOST) |
| 1427 return false; | 1426 return false; |
| 1428 #endif | 1427 #endif |
| 1429 return browser_->SupportsWindowFeature(Browser::FEATURE_TITLEBAR); | 1428 return browser_->SupportsWindowFeature(Browser::FEATURE_TITLEBAR); |
| 1430 } | 1429 } |
| 1431 | 1430 |
| 1432 SkBitmap BrowserView::GetWindowAppIcon() { | 1431 gfx::ImageSkia BrowserView::GetWindowAppIcon() { |
| 1433 if (browser_->is_app()) { | 1432 if (browser_->is_app()) { |
| 1434 TabContentsWrapper* contents = browser_->GetSelectedTabContentsWrapper(); | 1433 TabContentsWrapper* contents = browser_->GetSelectedTabContentsWrapper(); |
| 1435 if (contents && contents->extension_tab_helper()->GetExtensionAppIcon()) | 1434 if (contents && contents->extension_tab_helper()->GetExtensionAppIcon()) |
| 1436 return *contents->extension_tab_helper()->GetExtensionAppIcon(); | 1435 return *contents->extension_tab_helper()->GetExtensionAppIcon(); |
| 1437 } | 1436 } |
| 1438 | 1437 |
| 1439 return GetWindowIcon(); | 1438 return GetWindowIcon(); |
| 1440 } | 1439 } |
| 1441 | 1440 |
| 1442 SkBitmap BrowserView::GetWindowIcon() { | 1441 gfx::ImageSkia BrowserView::GetWindowIcon() { |
| 1443 if (browser_->is_app()) | 1442 if (browser_->is_app()) |
| 1444 return browser_->GetCurrentPageIcon(); | 1443 return browser_->GetCurrentPageIcon(); |
| 1445 return SkBitmap(); | 1444 return gfx::ImageSkia(); |
| 1446 } | 1445 } |
| 1447 | 1446 |
| 1448 bool BrowserView::ShouldShowWindowIcon() const { | 1447 bool BrowserView::ShouldShowWindowIcon() const { |
| 1449 #if defined(USE_ASH) | 1448 #if defined(USE_ASH) |
| 1450 // For Ash only, app host windows do not show an icon, crbug.com/119411. | 1449 // For Ash only, app host windows do not show an icon, crbug.com/119411. |
| 1451 // Child windows (e.g. extension panels, popups) do show an icon. | 1450 // Child windows (e.g. extension panels, popups) do show an icon. |
| 1452 if (browser_->is_app() && browser_->app_type() == Browser::APP_TYPE_HOST) | 1451 if (browser_->is_app() && browser_->app_type() == Browser::APP_TYPE_HOST) |
| 1453 return false; | 1452 return false; |
| 1454 #endif | 1453 #endif |
| 1455 return browser_->SupportsWindowFeature(Browser::FEATURE_TITLEBAR); | 1454 return browser_->SupportsWindowFeature(Browser::FEATURE_TITLEBAR); |
| (...skipping 958 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2414 | 2413 |
| 2415 PasswordGenerationBubbleView* bubble = | 2414 PasswordGenerationBubbleView* bubble = |
| 2416 new PasswordGenerationBubbleView(bounds, | 2415 new PasswordGenerationBubbleView(bounds, |
| 2417 this, | 2416 this, |
| 2418 web_contents->GetRenderViewHost(), | 2417 web_contents->GetRenderViewHost(), |
| 2419 browser_.get()); | 2418 browser_.get()); |
| 2420 views::BubbleDelegateView::CreateBubble(bubble); | 2419 views::BubbleDelegateView::CreateBubble(bubble); |
| 2421 bubble->SetAlignment(views::BubbleBorder::ALIGN_EDGE_TO_ANCHOR_EDGE); | 2420 bubble->SetAlignment(views::BubbleBorder::ALIGN_EDGE_TO_ANCHOR_EDGE); |
| 2422 bubble->Show(); | 2421 bubble->Show(); |
| 2423 } | 2422 } |
| OLD | NEW |