| 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_skia = ui::ResourceBundle::GetSharedInstance(). |
| 256 IDR_TEXTAREA_RESIZER); | 256 GetImageSkiaNamed(IDR_TEXTAREA_RESIZER); |
| 257 bitmap->buildMipMap(false); | 257 canvas->DrawBitmapInt(*image_skia, width() - image_skia->width(), |
| 258 canvas->DrawBitmapInt(*bitmap, width() - bitmap->width(), | 258 height() - image_skia->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 894 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1424 bool BrowserView::ShouldShowWindowTitle() const { | 1423 bool BrowserView::ShouldShowWindowTitle() const { |
| 1425 #if defined(USE_ASH) | 1424 #if defined(USE_ASH) |
| 1426 // For Ash only, app host windows do not show an icon, crbug.com/119411. | 1425 // For Ash only, app host windows do not show an icon, crbug.com/119411. |
| 1427 // Child windows (e.g. extension panels, popups) do show an icon. | 1426 // Child windows (e.g. extension panels, popups) do show an icon. |
| 1428 if (browser_->is_app() && browser_->app_type() == Browser::APP_TYPE_HOST) | 1427 if (browser_->is_app() && browser_->app_type() == Browser::APP_TYPE_HOST) |
| 1429 return false; | 1428 return false; |
| 1430 #endif | 1429 #endif |
| 1431 return browser_->SupportsWindowFeature(Browser::FEATURE_TITLEBAR); | 1430 return browser_->SupportsWindowFeature(Browser::FEATURE_TITLEBAR); |
| 1432 } | 1431 } |
| 1433 | 1432 |
| 1434 SkBitmap BrowserView::GetWindowAppIcon() { | 1433 gfx::ImageSkia BrowserView::GetWindowAppIcon() { |
| 1435 if (browser_->is_app()) { | 1434 if (browser_->is_app()) { |
| 1436 TabContentsWrapper* contents = browser_->GetSelectedTabContentsWrapper(); | 1435 TabContentsWrapper* contents = browser_->GetSelectedTabContentsWrapper(); |
| 1437 if (contents && contents->extension_tab_helper()->GetExtensionAppIcon()) | 1436 if (contents && contents->extension_tab_helper()->GetExtensionAppIcon()) |
| 1438 return *contents->extension_tab_helper()->GetExtensionAppIcon(); | 1437 return *contents->extension_tab_helper()->GetExtensionAppIcon(); |
| 1439 } | 1438 } |
| 1440 | 1439 |
| 1441 return GetWindowIcon(); | 1440 return GetWindowIcon(); |
| 1442 } | 1441 } |
| 1443 | 1442 |
| 1444 SkBitmap BrowserView::GetWindowIcon() { | 1443 gfx::ImageSkia BrowserView::GetWindowIcon() { |
| 1445 if (browser_->is_app()) | 1444 if (browser_->is_app()) |
| 1446 return browser_->GetCurrentPageIcon(); | 1445 return browser_->GetCurrentPageIcon(); |
| 1447 return SkBitmap(); | 1446 return gfx::ImageSkia(); |
| 1448 } | 1447 } |
| 1449 | 1448 |
| 1450 bool BrowserView::ShouldShowWindowIcon() const { | 1449 bool BrowserView::ShouldShowWindowIcon() const { |
| 1451 #if defined(USE_ASH) | 1450 #if defined(USE_ASH) |
| 1452 // For Ash only, app host windows do not show an icon, crbug.com/119411. | 1451 // For Ash only, app host windows do not show an icon, crbug.com/119411. |
| 1453 // Child windows (e.g. extension panels, popups) do show an icon. | 1452 // Child windows (e.g. extension panels, popups) do show an icon. |
| 1454 if (browser_->is_app() && browser_->app_type() == Browser::APP_TYPE_HOST) | 1453 if (browser_->is_app() && browser_->app_type() == Browser::APP_TYPE_HOST) |
| 1455 return false; | 1454 return false; |
| 1456 #endif | 1455 #endif |
| 1457 return browser_->SupportsWindowFeature(Browser::FEATURE_TITLEBAR); | 1456 return browser_->SupportsWindowFeature(Browser::FEATURE_TITLEBAR); |
| (...skipping 957 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2415 return; | 2414 return; |
| 2416 | 2415 |
| 2417 PasswordGenerationBubbleView* bubble = | 2416 PasswordGenerationBubbleView* bubble = |
| 2418 new PasswordGenerationBubbleView(bounds, | 2417 new PasswordGenerationBubbleView(bounds, |
| 2419 this, | 2418 this, |
| 2420 web_contents->GetRenderViewHost()); | 2419 web_contents->GetRenderViewHost()); |
| 2421 views::BubbleDelegateView::CreateBubble(bubble); | 2420 views::BubbleDelegateView::CreateBubble(bubble); |
| 2422 bubble->SetAlignment(views::BubbleBorder::ALIGN_EDGE_TO_ANCHOR_EDGE); | 2421 bubble->SetAlignment(views::BubbleBorder::ALIGN_EDGE_TO_ANCHOR_EDGE); |
| 2423 bubble->Show(); | 2422 bubble->Show(); |
| 2424 } | 2423 } |
| OLD | NEW |