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 #import <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
6 | 6 |
7 #include "base/logging.h" // for NOTREACHED() | 7 #include "base/logging.h" // for NOTREACHED() |
8 #include "base/mac/bundle_locations.h" | 8 #include "base/mac/bundle_locations.h" |
9 #include "base/mac/mac_util.h" | 9 #include "base/mac/mac_util.h" |
10 #include "base/sys_string_conversions.h" | 10 #include "base/sys_string_conversions.h" |
11 #include "chrome/browser/api/infobars/confirm_infobar_delegate.h" | 11 #include "chrome/browser/api/infobars/confirm_infobar_delegate.h" |
| 12 #include "chrome/browser/api/infobars/infobar_tab_service.h" |
12 #include "chrome/browser/api/infobars/link_infobar_delegate.h" | 13 #include "chrome/browser/api/infobars/link_infobar_delegate.h" |
13 #include "chrome/browser/infobars/infobar_tab_helper.h" | |
14 #import "chrome/browser/ui/cocoa/animatable_view.h" | 14 #import "chrome/browser/ui/cocoa/animatable_view.h" |
15 #import "chrome/browser/ui/cocoa/browser_window_controller.h" | 15 #import "chrome/browser/ui/cocoa/browser_window_controller.h" |
16 #include "chrome/browser/ui/cocoa/event_utils.h" | 16 #include "chrome/browser/ui/cocoa/event_utils.h" |
17 #import "chrome/browser/ui/cocoa/hyperlink_text_view.h" | 17 #import "chrome/browser/ui/cocoa/hyperlink_text_view.h" |
18 #include "chrome/browser/ui/cocoa/infobars/infobar.h" | 18 #include "chrome/browser/ui/cocoa/infobars/infobar.h" |
19 #import "chrome/browser/ui/cocoa/infobars/infobar_container_controller.h" | 19 #import "chrome/browser/ui/cocoa/infobars/infobar_container_controller.h" |
20 #import "chrome/browser/ui/cocoa/infobars/infobar_controller.h" | 20 #import "chrome/browser/ui/cocoa/infobars/infobar_controller.h" |
21 #import "chrome/browser/ui/cocoa/infobars/infobar_gradient_view.h" | 21 #import "chrome/browser/ui/cocoa/infobars/infobar_gradient_view.h" |
22 #import "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h" | 22 #import "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h" |
23 #include "chrome/browser/ui/tab_contents/tab_contents.h" | 23 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
(...skipping 20 matching lines...) Expand all Loading... |
44 // tip should be drawn. | 44 // tip should be drawn. |
45 - (NSPoint)pointForTipApex; | 45 - (NSPoint)pointForTipApex; |
46 @end | 46 @end |
47 | 47 |
48 @implementation InfoBarController | 48 @implementation InfoBarController |
49 | 49 |
50 @synthesize containerController = containerController_; | 50 @synthesize containerController = containerController_; |
51 @synthesize delegate = delegate_; | 51 @synthesize delegate = delegate_; |
52 | 52 |
53 - (id)initWithDelegate:(InfoBarDelegate*)delegate | 53 - (id)initWithDelegate:(InfoBarDelegate*)delegate |
54 owner:(InfoBarTabHelper*)owner { | 54 owner:(InfoBarTabService*)owner { |
55 DCHECK(delegate); | 55 DCHECK(delegate); |
56 if ((self = [super initWithNibName:@"InfoBar" | 56 if ((self = [super initWithNibName:@"InfoBar" |
57 bundle:base::mac::FrameworkBundle()])) { | 57 bundle:base::mac::FrameworkBundle()])) { |
58 delegate_ = delegate; | 58 delegate_ = delegate; |
59 owner_ = owner; | 59 owner_ = owner; |
60 } | 60 } |
61 return self; | 61 return self; |
62 } | 62 } |
63 | 63 |
64 // All infobars have an icon, so we set up the icon in the base class | 64 // All infobars have an icon, so we set up the icon in the base class |
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
444 if (delegate_->AsConfirmInfoBarDelegate()->LinkClicked(disposition)) | 444 if (delegate_->AsConfirmInfoBarDelegate()->LinkClicked(disposition)) |
445 [self removeSelf]; | 445 [self removeSelf]; |
446 } | 446 } |
447 | 447 |
448 @end | 448 @end |
449 | 449 |
450 | 450 |
451 ////////////////////////////////////////////////////////////////////////// | 451 ////////////////////////////////////////////////////////////////////////// |
452 // CreateInfoBar() implementations | 452 // CreateInfoBar() implementations |
453 | 453 |
454 InfoBar* LinkInfoBarDelegate::CreateInfoBar(InfoBarTabHelper* owner) { | 454 InfoBar* LinkInfoBarDelegate::CreateInfoBar(InfoBarTabService* owner) { |
455 LinkInfoBarController* controller = | 455 LinkInfoBarController* controller = |
456 [[LinkInfoBarController alloc] initWithDelegate:this owner:owner]; | 456 [[LinkInfoBarController alloc] initWithDelegate:this owner:owner]; |
457 return new InfoBar(controller, this); | 457 return new InfoBar(controller, this); |
458 } | 458 } |
459 | 459 |
460 InfoBar* ConfirmInfoBarDelegate::CreateInfoBar(InfoBarTabHelper* owner) { | 460 InfoBar* ConfirmInfoBarDelegate::CreateInfoBar(InfoBarTabService* owner) { |
461 ConfirmInfoBarController* controller = | 461 ConfirmInfoBarController* controller = |
462 [[ConfirmInfoBarController alloc] initWithDelegate:this owner:owner]; | 462 [[ConfirmInfoBarController alloc] initWithDelegate:this owner:owner]; |
463 return new InfoBar(controller, this); | 463 return new InfoBar(controller, this); |
464 } | 464 } |
OLD | NEW |