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.h" | 16 #include "chrome/browser/ui/passwords/passwords_model_delegate.h" |
17 #include "content/public/browser/web_contents.h" | 17 #include "content/public/browser/web_contents.h" |
| 18 #include "ui/base/material_design/material_design_controller.h" |
18 | 19 |
19 typedef void (^Callback)(void); | 20 typedef void (^Callback)(void); |
20 | 21 |
21 @interface ManagePasswordsBubbleCocoaNotificationBridge : NSObject { | 22 @interface ManagePasswordsBubbleCocoaNotificationBridge : NSObject { |
22 base::mac::ScopedBlock<Callback> callback_; | 23 base::mac::ScopedBlock<Callback> callback_; |
23 } | 24 } |
24 - (id)initWithCallback:(Callback)callback; | 25 - (id)initWithCallback:(Callback)callback; |
25 - (void)onClose; | 26 - (void)onClose; |
26 @end | 27 @end |
27 | 28 |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 } | 117 } |
117 DCHECK(!bubble_); | 118 DCHECK(!bubble_); |
118 | 119 |
119 NSWindow* window = [webContents->GetNativeView() window]; | 120 NSWindow* window = [webContents->GetNativeView() window]; |
120 if (!window) { | 121 if (!window) { |
121 // The tab isn't active right now. | 122 // The tab isn't active right now. |
122 return; | 123 return; |
123 } | 124 } |
124 BrowserWindowController* bwc = | 125 BrowserWindowController* bwc = |
125 [BrowserWindowController browserWindowControllerForWindow:window]; | 126 [BrowserWindowController browserWindowControllerForWindow:window]; |
| 127 if (ui::MaterialDesignController::IsSecondaryUiMaterial()) { |
| 128 NSPoint anchor_point = [bwc bookmarkBubblePoint]; |
| 129 ShowViewsManagePasswordsBubbleOnCocoaBrowser(anchor_point, webContents, |
| 130 user_action); |
| 131 return; |
| 132 } |
126 bubble_ = new ManagePasswordsBubbleCocoa( | 133 bubble_ = new ManagePasswordsBubbleCocoa( |
127 webContents, user_action ? ManagePasswordsBubbleModel::USER_ACTION | 134 webContents, user_action ? ManagePasswordsBubbleModel::USER_ACTION |
128 : ManagePasswordsBubbleModel::AUTOMATIC, | 135 : ManagePasswordsBubbleModel::AUTOMATIC, |
129 [bwc locationBarBridge]->manage_passwords_decoration()->icon()); | 136 [bwc locationBarBridge]->manage_passwords_decoration()->icon()); |
130 | 137 |
131 bubble_->Show(user_action); | 138 bubble_->Show(user_action); |
132 } | 139 } |
OLD | NEW |