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

Side by Side Diff: chrome/browser/ui/cocoa/passwords/manage_passwords_bubble_cocoa.mm

Issue 528213004: Don't try to show the Mac password bubble on an inactive tab. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/passwords/manage_passwords_bubble_cocoa_unittest.mm » ('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 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/manage_passwords_bubble_cocoa.h" 5 #import "chrome/browser/ui/cocoa/passwords/manage_passwords_bubble_cocoa.h"
6 6
7 #include "base/mac/scoped_block.h" 7 #include "base/mac/scoped_block.h"
8 #include "chrome/browser/ui/browser_dialogs.h" 8 #include "chrome/browser/ui/browser_dialogs.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"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 ManagePasswordsBubbleCocoa* instance = ManagePasswordsBubbleCocoa::instance(); 44 ManagePasswordsBubbleCocoa* instance = ManagePasswordsBubbleCocoa::instance();
45 if (instance && (instance->webContents_ != webContents)) { 45 if (instance && (instance->webContents_ != webContents)) {
46 // The bubble is currently shown for some other tab. We should close it now 46 // The bubble is currently shown for some other tab. We should close it now
47 // and open for |webContents|. 47 // and open for |webContents|.
48 instance->Close(); 48 instance->Close();
49 } 49 }
50 50
51 ManagePasswordsUIController* controller = 51 ManagePasswordsUIController* controller =
52 ManagePasswordsUIController::FromWebContents(webContents); 52 ManagePasswordsUIController::FromWebContents(webContents);
53 NSWindow* window = webContents->GetTopLevelNativeWindow(); 53 NSWindow* window = webContents->GetTopLevelNativeWindow();
54 if (!window) {
55 // The tab isn't active right now.
56 return;
57 }
54 BrowserWindowController* bwc = 58 BrowserWindowController* bwc =
55 [BrowserWindowController browserWindowControllerForWindow:window]; 59 [BrowserWindowController browserWindowControllerForWindow:window];
56 ManagePasswordsBubbleCocoa::ShowBubble( 60 ManagePasswordsBubbleCocoa::ShowBubble(
57 webContents, 61 webContents,
58 password_manager::ui::IsAutomaticDisplayState(controller->state()) 62 password_manager::ui::IsAutomaticDisplayState(controller->state())
59 ? ManagePasswordsBubble::AUTOMATIC 63 ? ManagePasswordsBubble::AUTOMATIC
60 : ManagePasswordsBubble::USER_ACTION, 64 : ManagePasswordsBubble::USER_ACTION,
61 [bwc locationBarBridge]->manage_passwords_decoration()->icon()); 65 [bwc locationBarBridge]->manage_passwords_decoration()->icon());
62 } 66 }
63 } // namespace chrome 67 } // namespace chrome
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 127
124 // static 128 // static
125 void ManagePasswordsBubbleCocoa::ShowBubble(content::WebContents* webContents, 129 void ManagePasswordsBubbleCocoa::ShowBubble(content::WebContents* webContents,
126 DisplayReason displayReason, 130 DisplayReason displayReason,
127 ManagePasswordsIcon* icon) { 131 ManagePasswordsIcon* icon) {
128 if (bubble_) 132 if (bubble_)
129 return; 133 return;
130 bubble_ = new ManagePasswordsBubbleCocoa(webContents, displayReason, icon); 134 bubble_ = new ManagePasswordsBubbleCocoa(webContents, displayReason, icon);
131 bubble_->Show(); 135 bubble_->Show();
132 } 136 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/passwords/manage_passwords_bubble_cocoa_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698