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

Side by Side Diff: chrome/browser/ui/views/passwords/manage_passwords_bubble_view.cc

Issue 328113003: Revert "Password bubble: Add an "active" icon state, and a new disabled icon." (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #include "chrome/browser/ui/views/passwords/manage_passwords_bubble_view.h" 5 #include "chrome/browser/ui/views/passwords/manage_passwords_bubble_view.h"
6 6
7 #include "chrome/browser/chrome_notification_types.h" 7 #include "chrome/browser/chrome_notification_types.h"
8 #include "chrome/browser/ui/browser.h" 8 #include "chrome/browser/ui/browser.h"
9 #include "chrome/browser/ui/browser_finder.h" 9 #include "chrome/browser/ui/browser_finder.h"
10 #include "chrome/browser/ui/browser_window.h" 10 #include "chrome/browser/ui/browser_window.h"
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 Browser* browser = chrome::FindBrowserWithWebContents(web_contents); 366 Browser* browser = chrome::FindBrowserWithWebContents(web_contents);
367 DCHECK(browser); 367 DCHECK(browser);
368 DCHECK(browser->window()); 368 DCHECK(browser->window());
369 DCHECK(browser->fullscreen_controller()); 369 DCHECK(browser->fullscreen_controller());
370 370
371 if (IsShowing()) 371 if (IsShowing())
372 return; 372 return;
373 373
374 BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser); 374 BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser);
375 bool is_fullscreen = browser_view->IsFullscreen(); 375 bool is_fullscreen = browser_view->IsFullscreen();
376 ManagePasswordsIconView* anchor_view = 376 views::View* anchor_view = is_fullscreen ?
377 is_fullscreen 377 NULL : browser_view->GetLocationBarView()->manage_passwords_icon_view();
378 ? NULL
379 : browser_view->GetLocationBarView()->manage_passwords_icon_view();
380 manage_passwords_bubble_ = new ManagePasswordsBubbleView( 378 manage_passwords_bubble_ = new ManagePasswordsBubbleView(
381 web_contents, anchor_view, reason); 379 web_contents, anchor_view, reason);
382 380
383 if (is_fullscreen) { 381 if (is_fullscreen) {
384 manage_passwords_bubble_->set_parent_window( 382 manage_passwords_bubble_->set_parent_window(
385 web_contents->GetTopLevelNativeWindow()); 383 web_contents->GetTopLevelNativeWindow());
386 } 384 }
387 385
388 views::BubbleDelegateView::CreateBubble(manage_passwords_bubble_); 386 views::BubbleDelegateView::CreateBubble(manage_passwords_bubble_);
389 387
390 // Adjust for fullscreen after creation as it relies on the content size. 388 // Adjust for fullscreen after creation as it relies on the content size.
391 if (is_fullscreen) { 389 if (is_fullscreen) {
392 manage_passwords_bubble_->AdjustForFullscreen( 390 manage_passwords_bubble_->AdjustForFullscreen(
393 browser_view->GetBoundsInScreen()); 391 browser_view->GetBoundsInScreen());
394 } 392 }
393
395 manage_passwords_bubble_->GetWidget()->Show(); 394 manage_passwords_bubble_->GetWidget()->Show();
396 manage_passwords_bubble_->SetArrowPaintType(views::BubbleBorder::PAINT_NONE); 395 manage_passwords_bubble_->SetArrowPaintType(views::BubbleBorder::PAINT_NONE);
397 } 396 }
398 397
399 // static 398 // static
400 void ManagePasswordsBubbleView::CloseBubble() { 399 void ManagePasswordsBubbleView::CloseBubble() {
401 if (manage_passwords_bubble_) 400 if (manage_passwords_bubble_)
402 manage_passwords_bubble_->Close(); 401 manage_passwords_bubble_->Close();
403 } 402 }
404 403
405 // static 404 // static
406 bool ManagePasswordsBubbleView::IsShowing() { 405 bool ManagePasswordsBubbleView::IsShowing() {
407 // The bubble may be in the process of closing. 406 // The bubble may be in the process of closing.
408 return (manage_passwords_bubble_ != NULL) && 407 return (manage_passwords_bubble_ != NULL) &&
409 manage_passwords_bubble_->GetWidget()->IsVisible(); 408 manage_passwords_bubble_->GetWidget()->IsVisible();
410 } 409 }
411 410
412 ManagePasswordsBubbleView::ManagePasswordsBubbleView( 411 ManagePasswordsBubbleView::ManagePasswordsBubbleView(
413 content::WebContents* web_contents, 412 content::WebContents* web_contents,
414 ManagePasswordsIconView* anchor_view, 413 views::View* anchor_view,
415 DisplayReason reason) 414 DisplayReason reason)
416 : ManagePasswordsBubble(web_contents, reason), 415 : ManagePasswordsBubble(web_contents, reason),
417 BubbleDelegateView(anchor_view, 416 BubbleDelegateView(anchor_view,
418 anchor_view ? views::BubbleBorder::TOP_RIGHT 417 anchor_view ? views::BubbleBorder::TOP_RIGHT
419 : views::BubbleBorder::NONE), 418 : views::BubbleBorder::NONE) {
420 anchor_view_(anchor_view) {
421 // Compensate for built-in vertical padding in the anchor view's image. 419 // Compensate for built-in vertical padding in the anchor view's image.
422 set_anchor_view_insets(gfx::Insets(2, 0, 2, 0)); 420 set_anchor_view_insets(gfx::Insets(2, 0, 2, 0));
423 set_notify_enter_exit_on_child(true); 421 set_notify_enter_exit_on_child(true);
424 if (anchor_view)
425 anchor_view->SetActive(true);
426 } 422 }
427 423
428 ManagePasswordsBubbleView::~ManagePasswordsBubbleView() { 424 ManagePasswordsBubbleView::~ManagePasswordsBubbleView() {}
429 if (anchor_view_)
430 anchor_view_->SetActive(false);
431 }
432 425
433 void ManagePasswordsBubbleView::AdjustForFullscreen( 426 void ManagePasswordsBubbleView::AdjustForFullscreen(
434 const gfx::Rect& screen_bounds) { 427 const gfx::Rect& screen_bounds) {
435 if (GetAnchorView()) 428 if (GetAnchorView())
436 return; 429 return;
437 430
438 // The bubble's padding from the screen edge, used in fullscreen. 431 // The bubble's padding from the screen edge, used in fullscreen.
439 const int kFullscreenPaddingEnd = 20; 432 const int kFullscreenPaddingEnd = 20;
440 const size_t bubble_half_width = width() / 2; 433 const size_t bubble_half_width = width() / 2;
441 const int x_pos = base::i18n::IsRTL() ? 434 const int x_pos = base::i18n::IsRTL() ?
(...skipping 18 matching lines...) Expand all
460 else 453 else
461 AddChildView(new ManageView(this)); 454 AddChildView(new ManageView(this));
462 } 455 }
463 456
464 void ManagePasswordsBubbleView::WindowClosing() { 457 void ManagePasswordsBubbleView::WindowClosing() {
465 // Close() closes the window asynchronously, so by the time we reach here, 458 // Close() closes the window asynchronously, so by the time we reach here,
466 // |manage_passwords_bubble_| may have already been reset. 459 // |manage_passwords_bubble_| may have already been reset.
467 if (manage_passwords_bubble_ == this) 460 if (manage_passwords_bubble_ == this)
468 manage_passwords_bubble_ = NULL; 461 manage_passwords_bubble_ = NULL;
469 } 462 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698