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

Side by Side Diff: chrome/browser/views/infobars/infobars.cc

Issue 160084: Chaos geolocation demo, non-WebKit part. Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 11 years, 4 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
« no previous file with comments | « chrome/browser/views/infobars/infobars.h ('k') | chrome/chrome.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 }
OLDNEW
« no previous file with comments | « chrome/browser/views/infobars/infobars.h ('k') | chrome/chrome.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698