| 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/infobars/infobars.h" | 5 #include "chrome/browser/views/infobars/infobars.h" |
| 6 | 6 |
| 7 #include "app/gfx/canvas.h" | 7 #include "app/gfx/canvas.h" |
| 8 #include "app/l10n_util.h" | 8 #include "app/l10n_util.h" |
| 9 #include "app/resource_bundle.h" | 9 #include "app/resource_bundle.h" |
| 10 #include "app/slide_animation.h" | 10 #include "app/slide_animation.h" |
| (...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 493 | 493 |
| 494 ConfirmInfoBarDelegate* ConfirmInfoBar::GetDelegate() { | 494 ConfirmInfoBarDelegate* ConfirmInfoBar::GetDelegate() { |
| 495 return delegate()->AsConfirmInfoBarDelegate(); | 495 return delegate()->AsConfirmInfoBarDelegate(); |
| 496 } | 496 } |
| 497 | 497 |
| 498 void ConfirmInfoBar::Init() { | 498 void ConfirmInfoBar::Init() { |
| 499 AddChildView(ok_button_); | 499 AddChildView(ok_button_); |
| 500 AddChildView(cancel_button_); | 500 AddChildView(cancel_button_); |
| 501 } | 501 } |
| 502 | 502 |
| 503 // GeolocInfoBar, public: ------------------------------------------------------ |
| 504 class GeolocInfoBarBackground : public views::Background { |
| 505 public: |
| 506 GeolocInfoBarBackground() { |
| 507 gradient_background_.reset( |
| 508 views::Background::CreateSolidBackground(255, 0, 0)); |
| 509 } |
| 510 |
| 511 // Overridden from views::View: |
| 512 virtual void Paint(gfx::Canvas* canvas, views::View* view) const { |
| 513 // First paint the gradient background. |
| 514 gradient_background_->Paint(canvas, view); |
| 515 |
| 516 // Now paint the separator line. |
| 517 canvas->FillRectInt(ResourceBundle::toolbar_separator_color, 0, |
| 518 view->height() - kSeparatorLineHeight, view->width(), |
| 519 kSeparatorLineHeight); |
| 520 } |
| 521 |
| 522 private: |
| 523 scoped_ptr<views::Background> gradient_background_; |
| 524 |
| 525 DISALLOW_COPY_AND_ASSIGN(GeolocInfoBarBackground); |
| 526 }; |
| 527 |
| 528 GeolocInfoBar::GeolocInfoBar(ConfirmInfoBarDelegate* delegate) |
| 529 : ConfirmInfoBar(delegate) { |
| 530 set_background(new GeolocInfoBarBackground); |
| 531 } |
| 532 |
| 533 // GeolocInfoBar, private: ---------------------------------------------------- |
| 534 |
| 535 GeolocInfoBarDelegate* GeolocInfoBar::GetDelegate() { |
| 536 return delegate()->AsGeolocInfoBarDelegate(); |
| 537 } |
| 538 |
| 503 // AlertInfoBarDelegate, InfoBarDelegate overrides: ---------------------------- | 539 // AlertInfoBarDelegate, InfoBarDelegate overrides: ---------------------------- |
| 504 | 540 |
| 505 InfoBar* AlertInfoBarDelegate::CreateInfoBar() { | 541 InfoBar* AlertInfoBarDelegate::CreateInfoBar() { |
| 506 return new AlertInfoBar(this); | 542 return new AlertInfoBar(this); |
| 507 } | 543 } |
| 508 | 544 |
| 509 // LinkInfoBarDelegate, InfoBarDelegate overrides: ----------------------------- | 545 // LinkInfoBarDelegate, InfoBarDelegate overrides: ----------------------------- |
| 510 | 546 |
| 511 InfoBar* LinkInfoBarDelegate::CreateInfoBar() { | 547 InfoBar* LinkInfoBarDelegate::CreateInfoBar() { |
| 512 return new LinkInfoBar(this); | 548 return new LinkInfoBar(this); |
| 513 } | 549 } |
| 514 | 550 |
| 515 // ConfirmInfoBarDelegate, InfoBarDelegate overrides: -------------------------- | 551 // ConfirmInfoBarDelegate, InfoBarDelegate overrides: -------------------------- |
| 516 | 552 |
| 517 InfoBar* ConfirmInfoBarDelegate::CreateInfoBar() { | 553 InfoBar* ConfirmInfoBarDelegate::CreateInfoBar() { |
| 518 return new ConfirmInfoBar(this); | 554 return new ConfirmInfoBar(this); |
| 519 } | 555 } |
| 556 |
| 557 // GeolocInfoBarDelegate, InfoBarDelegate overrides: -------------------------- |
| 558 |
| 559 InfoBar* GeolocInfoBarDelegate::CreateInfoBar() { |
| 560 DCHECK(false); |
| 561 return new GeolocInfoBar(this); |
| 562 } |
| OLD | NEW |