| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/browser/ui/cocoa/passwords/passwords_bubble_cocoa.h" | 5 #import "chrome/browser/ui/cocoa/passwords/passwords_bubble_cocoa.h" |
| 6 | 6 |
| 7 #include "base/mac/foundation_util.h" | 7 #include "base/mac/foundation_util.h" |
| 8 #include "base/mac/scoped_block.h" | 8 #include "base/mac/scoped_block.h" |
| 9 #include "chrome/browser/ui/browser_finder.h" | 9 #include "chrome/browser/ui/browser_finder.h" |
| 10 #import "chrome/browser/ui/cocoa/browser_window_controller.h" | 10 #import "chrome/browser/ui/cocoa/browser_window_controller.h" |
| 11 #import "chrome/browser/ui/cocoa/info_bubble_window.h" | 11 #import "chrome/browser/ui/cocoa/info_bubble_window.h" |
| 12 #include "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h" | 12 #include "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h" |
| 13 #include "chrome/browser/ui/cocoa/location_bar/manage_passwords_decoration.h" | 13 #include "chrome/browser/ui/cocoa/location_bar/manage_passwords_decoration.h" |
| 14 #import "chrome/browser/ui/cocoa/passwords/passwords_bubble_controller.h" | 14 #import "chrome/browser/ui/cocoa/passwords/passwords_bubble_controller.h" |
| 15 #include "chrome/browser/ui/passwords/manage_passwords_icon.h" | 15 #include "chrome/browser/ui/passwords/manage_passwords_icon.h" |
| 16 #include "chrome/browser/ui/passwords/passwords_model_delegate_proxy.h" |
| 16 #include "content/public/browser/web_contents.h" | 17 #include "content/public/browser/web_contents.h" |
| 17 | 18 |
| 18 typedef void (^Callback)(void); | 19 typedef void (^Callback)(void); |
| 19 | 20 |
| 20 @interface ManagePasswordsBubbleCocoaNotificationBridge : NSObject { | 21 @interface ManagePasswordsBubbleCocoaNotificationBridge : NSObject { |
| 21 base::mac::ScopedBlock<Callback> callback_; | 22 base::mac::ScopedBlock<Callback> callback_; |
| 22 } | 23 } |
| 23 - (id)initWithCallback:(Callback)callback; | 24 - (id)initWithCallback:(Callback)callback; |
| 24 - (void)onClose; | 25 - (void)onClose; |
| 25 @end | 26 @end |
| (...skipping 10 matching lines...) Expand all Loading... |
| 36 } | 37 } |
| 37 @end | 38 @end |
| 38 | 39 |
| 39 // static | 40 // static |
| 40 ManagePasswordsBubbleCocoa* ManagePasswordsBubbleCocoa::bubble_ = NULL; | 41 ManagePasswordsBubbleCocoa* ManagePasswordsBubbleCocoa::bubble_ = NULL; |
| 41 | 42 |
| 42 ManagePasswordsBubbleCocoa::ManagePasswordsBubbleCocoa( | 43 ManagePasswordsBubbleCocoa::ManagePasswordsBubbleCocoa( |
| 43 content::WebContents* webContents, | 44 content::WebContents* webContents, |
| 44 ManagePasswordsBubbleModel::DisplayReason displayReason, | 45 ManagePasswordsBubbleModel::DisplayReason displayReason, |
| 45 ManagePasswordsIcon* icon) | 46 ManagePasswordsIcon* icon) |
| 46 : model_(webContents, displayReason), | 47 : model_(PasswordsModelDelegateProxyFromWebContents(webContents), |
| 48 displayReason), |
| 47 icon_(icon), | 49 icon_(icon), |
| 48 controller_(nil), | 50 controller_(nil), |
| 49 webContents_(webContents), | 51 webContents_(webContents), |
| 50 bridge_(nil) { | 52 bridge_(nil) { |
| 51 DCHECK(icon_); | 53 DCHECK(icon_); |
| 52 icon_->SetActive(true); | 54 icon_->SetActive(true); |
| 53 } | 55 } |
| 54 | 56 |
| 55 ManagePasswordsBubbleCocoa::~ManagePasswordsBubbleCocoa() { | 57 ManagePasswordsBubbleCocoa::~ManagePasswordsBubbleCocoa() { |
| 56 [[NSNotificationCenter defaultCenter] removeObserver:bridge_]; | 58 [[NSNotificationCenter defaultCenter] removeObserver:bridge_]; |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 } | 123 } |
| 122 BrowserWindowController* bwc = | 124 BrowserWindowController* bwc = |
| 123 [BrowserWindowController browserWindowControllerForWindow:window]; | 125 [BrowserWindowController browserWindowControllerForWindow:window]; |
| 124 bubble_ = new ManagePasswordsBubbleCocoa( | 126 bubble_ = new ManagePasswordsBubbleCocoa( |
| 125 webContents, user_action ? ManagePasswordsBubbleModel::USER_ACTION | 127 webContents, user_action ? ManagePasswordsBubbleModel::USER_ACTION |
| 126 : ManagePasswordsBubbleModel::AUTOMATIC, | 128 : ManagePasswordsBubbleModel::AUTOMATIC, |
| 127 [bwc locationBarBridge]->manage_passwords_decoration()->icon()); | 129 [bwc locationBarBridge]->manage_passwords_decoration()->icon()); |
| 128 | 130 |
| 129 bubble_->Show(user_action); | 131 bubble_->Show(user_action); |
| 130 } | 132 } |
| OLD | NEW |