OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_util.h" | 8 #include "base/mac_util.h" |
9 #include "base/sys_string_conversions.h" | 9 #include "base/sys_string_conversions.h" |
| 10 #include "chrome/browser/cocoa/event_utils.h" |
10 #include "chrome/browser/cocoa/infobar.h" | 11 #include "chrome/browser/cocoa/infobar.h" |
11 #import "chrome/browser/cocoa/infobar_container_controller.h" | 12 #import "chrome/browser/cocoa/infobar_container_controller.h" |
12 #import "chrome/browser/cocoa/infobar_controller.h" | 13 #import "chrome/browser/cocoa/infobar_controller.h" |
13 #include "chrome/browser/tab_contents/tab_contents.h" | 14 #include "chrome/browser/tab_contents/tab_contents.h" |
14 #import "chrome/common/cocoa_utils.h" | |
15 #include "skia/ext/skia_utils_mac.h" | 15 #include "skia/ext/skia_utils_mac.h" |
16 #include "webkit/glue/window_open_disposition.h" | 16 #include "webkit/glue/window_open_disposition.h" |
17 | 17 |
18 | 18 |
19 @interface InfoBarController (PrivateMethods) | 19 @interface InfoBarController (PrivateMethods) |
20 // Closes the infobar by calling RemoveDelegate on the container. | 20 // Closes the infobar by calling RemoveDelegate on the container. |
21 // This will remove the infobar from its associated TabContents as | 21 // This will remove the infobar from its associated TabContents as |
22 // well as trigger the deletion of this InfoBarController. Once the | 22 // well as trigger the deletion of this InfoBarController. Once the |
23 // delegate is removed from the container, it is no longer needed, so | 23 // delegate is removed from the container, it is no longer needed, so |
24 // we ask it to delete itself. | 24 // we ask it to delete itself. |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 | 170 |
171 // Remove the ok and cancel buttons, since they are not needed. | 171 // Remove the ok and cancel buttons, since they are not needed. |
172 [okButton_ removeFromSuperview]; | 172 [okButton_ removeFromSuperview]; |
173 [cancelButton_ removeFromSuperview]; | 173 [cancelButton_ removeFromSuperview]; |
174 } | 174 } |
175 | 175 |
176 // Called when someone clicks on the link in the infobar. This method | 176 // Called when someone clicks on the link in the infobar. This method |
177 // is called by the InfobarTextField on its delegate (the | 177 // is called by the InfobarTextField on its delegate (the |
178 // LinkInfoBarController). | 178 // LinkInfoBarController). |
179 - (void)linkClicked { | 179 - (void)linkClicked { |
180 WindowOpenDisposition disposition = event_utils::DispositionFromEventFlags( | 180 WindowOpenDisposition disposition = |
181 [[NSApp currentEvent] modifierFlags]); | 181 event_utils::WindowOpenDispositionFromNSEvent([NSApp currentEvent]); |
182 if (delegate_->AsLinkInfoBarDelegate()->LinkClicked(disposition)) | 182 if (delegate_->AsLinkInfoBarDelegate()->LinkClicked(disposition)) |
183 [self closeInfoBar]; | 183 [self closeInfoBar]; |
184 } | 184 } |
185 | 185 |
186 @end | 186 @end |
187 | 187 |
188 | 188 |
189 ///////////////////////////////////////////////////////////////////////// | 189 ///////////////////////////////////////////////////////////////////////// |
190 // ConfirmInfoBarController implementation | 190 // ConfirmInfoBarController implementation |
191 | 191 |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 LinkInfoBarController* controller = | 288 LinkInfoBarController* controller = |
289 [[LinkInfoBarController alloc] initWithDelegate:this]; | 289 [[LinkInfoBarController alloc] initWithDelegate:this]; |
290 return new InfoBar(controller); | 290 return new InfoBar(controller); |
291 } | 291 } |
292 | 292 |
293 InfoBar* ConfirmInfoBarDelegate::CreateInfoBar() { | 293 InfoBar* ConfirmInfoBarDelegate::CreateInfoBar() { |
294 ConfirmInfoBarController* controller = | 294 ConfirmInfoBarController* controller = |
295 [[ConfirmInfoBarController alloc] initWithDelegate:this]; | 295 [[ConfirmInfoBarController alloc] initWithDelegate:this]; |
296 return new InfoBar(controller); | 296 return new InfoBar(controller); |
297 } | 297 } |
OLD | NEW |