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

Unified Diff: chrome/browser/ui/cocoa/passwords/manage_passwords_bubble_controller.mm

Issue 1411733009: Bulk rename files in chrome/browser/ui/cocoa/passwords/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@fix-federation
Patch Set: Created 5 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/cocoa/passwords/manage_passwords_bubble_controller.mm
diff --git a/chrome/browser/ui/cocoa/passwords/manage_passwords_bubble_controller.mm b/chrome/browser/ui/cocoa/passwords/manage_passwords_bubble_controller.mm
deleted file mode 100644
index e7369e2fe7464e7f1e42a4515ba81106961bb562..0000000000000000000000000000000000000000
--- a/chrome/browser/ui/cocoa/passwords/manage_passwords_bubble_controller.mm
+++ /dev/null
@@ -1,161 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#import "chrome/browser/ui/cocoa/passwords/manage_passwords_bubble_controller.h"
-
-#include "base/mac/scoped_nsobject.h"
-#include "chrome/browser/ui/browser_finder.h"
-#import "chrome/browser/ui/cocoa/browser_window_controller.h"
-#import "chrome/browser/ui/cocoa/info_bubble_view.h"
-#import "chrome/browser/ui/cocoa/info_bubble_window.h"
-#include "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h"
-#import "chrome/browser/ui/cocoa/passwords/manage_passwords_bubble_account_chooser_view_controller.h"
-#import "chrome/browser/ui/cocoa/passwords/manage_passwords_bubble_auto_signin_view_controller.h"
-#import "chrome/browser/ui/cocoa/passwords/manage_passwords_bubble_confirmation_view_controller.h"
-#import "chrome/browser/ui/cocoa/passwords/manage_passwords_bubble_manage_view_controller.h"
-#include "ui/base/cocoa/window_size_constants.h"
-
-@interface ManagePasswordsBubbleController ()
-// Updates the content view controller according to the current state.
-- (void)updateState;
-@end
-
-@implementation ManagePasswordsBubbleController
-- (id)initWithParentWindow:(NSWindow*)parentWindow
- model:(ManagePasswordsBubbleModel*)model {
- NSRect contentRect = ui::kWindowSizeDeterminedLater;
- base::scoped_nsobject<InfoBubbleWindow> window(
- [[InfoBubbleWindow alloc] initWithContentRect:contentRect
- styleMask:NSBorderlessWindowMask
- backing:NSBackingStoreBuffered
- defer:NO]);
- if ((self = [super initWithWindow:window
- parentWindow:parentWindow
- anchoredAt:NSZeroPoint])) {
- model_ = model;
- [self updateState];
- }
- return self;
-}
-
-- (void)dealloc {
- [currentController_ setDelegate:nil];
- [super dealloc];
-}
-
-- (void)showWindow:(id)sender {
- [self performLayout];
- [super showWindow:sender];
-}
-
-- (void)close {
- [currentController_ bubbleWillDisappear];
- [super close];
-}
-
-- (void)updateState {
- // Find the next view controller.
- currentController_.reset();
- if (model_->state() == password_manager::ui::PENDING_PASSWORD_STATE) {
- currentController_.reset(
- [[ManagePasswordsBubblePendingViewController alloc]
- initWithModel:model_
- delegate:self]);
- } else if (model_->state() == password_manager::ui::CONFIRMATION_STATE) {
- currentController_.reset(
- [[ManagePasswordsBubbleConfirmationViewController alloc]
- initWithModel:model_
- delegate:self]);
- } else if (model_->state() == password_manager::ui::MANAGE_STATE) {
- currentController_.reset(
- [[ManagePasswordsBubbleManageViewController alloc]
- initWithModel:model_
- delegate:self]);
- } else if (model_->state() == password_manager::ui::AUTO_SIGNIN_STATE) {
- currentController_.reset(
- [[ManagePasswordsBubbleAutoSigninViewController alloc]
- initWithModel:model_
- delegate:self]);
- } else if (model_->state() ==
- password_manager::ui::CREDENTIAL_REQUEST_STATE) {
- currentController_.reset(
- [[ManagePasswordsBubbleAccountChooserViewController alloc]
- initWithModel:model_
- delegate:self]);
- } else {
- NOTREACHED();
- }
- [self performLayout];
-}
-
-- (void)performLayout {
- if (!currentController_)
- return;
-
- // Update the window.
- NSWindow* window = [self window];
- [[window contentView] setSubviews:@[ [currentController_ view] ]];
- NSButton* button = [currentController_ defaultButton];
- if (button)
- [window setDefaultButtonCell:[button cell]];
-
- NSPoint anchorPoint;
- info_bubble::BubbleArrowLocation arrow;
- Browser* browser = chrome::FindBrowserWithWindow([self parentWindow]);
- bool hasLocationBar =
- browser && browser->SupportsWindowFeature(Browser::FEATURE_LOCATIONBAR);
-
- if (hasLocationBar) {
- BrowserWindowController* controller = [BrowserWindowController
- browserWindowControllerForWindow:[self parentWindow]];
- anchorPoint =
- [controller locationBarBridge]->GetManagePasswordsBubblePoint();
- arrow = info_bubble::kTopRight;
- } else {
- // Center the bubble if there's no location bar.
- NSRect contentFrame = [[[self parentWindow] contentView] frame];
- anchorPoint = NSMakePoint(NSMidX(contentFrame), NSMaxY(contentFrame));
- arrow = info_bubble::kNoArrow;
- }
-
- // Update the anchor arrow.
- [[self bubble] setArrowLocation:arrow];
-
- // Update the anchor point.
- anchorPoint = [[self parentWindow] convertBaseToScreen:anchorPoint];
- [self setAnchorPoint:anchorPoint];
-
- // Update the frame.
- CGFloat height = NSHeight([[currentController_ view] frame]);
- CGFloat width = NSWidth([[currentController_ view] frame]);
- CGFloat x = anchorPoint.x - width;
- CGFloat y = anchorPoint.y - height;
-
- // Make the frame large enough for the arrow.
- if (hasLocationBar) {
- height += info_bubble::kBubbleArrowHeight;
- x += info_bubble::kBubbleArrowXOffset +
- (0.5 * info_bubble::kBubbleArrowWidth);
- }
-
- [window setFrame:NSMakeRect(x, y, width, height)
- display:YES
- animate:[window isVisible]];
-}
-
-#pragma mark ManagePasswordsBubbleContentViewDelegate
-
-- (void)viewShouldDismiss {
- [self close];
-}
-
-@end
-
-@implementation ManagePasswordsBubbleController (Testing)
-
-- (NSViewController*)currentController {
- return currentController_.get();
-}
-
-@end

Powered by Google App Engine
This is Rietveld 408576698