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

Unified Diff: chrome/browser/ui/views/passwords/manage_passwords_bubble_view.cc

Issue 795053003: [Password Manager] Close the bubble when fullscreen state gets change. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Incorporated Vasilii's review comments. Created 6 years 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/views/passwords/manage_passwords_bubble_view.cc
diff --git a/chrome/browser/ui/views/passwords/manage_passwords_bubble_view.cc b/chrome/browser/ui/views/passwords/manage_passwords_bubble_view.cc
index 28a7585e110e18dbc10d22a30c153404628896e5..507240501534ca3f5a87a1e8d41d57d60c0b9d51 100644
--- a/chrome/browser/ui/views/passwords/manage_passwords_bubble_view.cc
+++ b/chrome/browser/ui/views/passwords/manage_passwords_bubble_view.cc
@@ -4,7 +4,6 @@
#include "chrome/browser/ui/views/passwords/manage_passwords_bubble_view.h"
-#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/fullscreen/fullscreen_controller.h"
@@ -12,14 +11,11 @@
#include "chrome/browser/ui/passwords/manage_passwords_ui_controller.h"
#include "chrome/browser/ui/passwords/save_password_refusal_combobox_model.h"
#include "chrome/browser/ui/views/frame/browser_view.h"
-#include "chrome/browser/ui/views/location_bar/location_bar_view.h"
#include "chrome/browser/ui/views/passwords/credentials_item_view.h"
#include "chrome/browser/ui/views/passwords/manage_password_items_view.h"
#include "chrome/browser/ui/views/passwords/manage_passwords_icon_view.h"
#include "chrome/grit/generated_resources.h"
-#include "content/public/browser/notification_source.h"
#include "content/public/browser/render_view_host.h"
-#include "content/public/browser/web_contents.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/views/controls/button/blue_button.h"
@@ -1021,9 +1017,7 @@ ManagePasswordsBubbleView::ManagePasswordsBubbleView(
ManagePasswordsIconView* anchor_view,
DisplayReason reason)
: ManagePasswordsBubble(web_contents, reason),
- BubbleDelegateView(anchor_view,
- anchor_view ? views::BubbleBorder::TOP_RIGHT
- : views::BubbleBorder::NONE),
+ ManagedFullScreenBubbleDelegateView(anchor_view, web_contents),
anchor_view_(anchor_view),
initially_focused_view_(NULL) {
// Compensate for built-in vertical padding in the anchor view's image.
@@ -1031,13 +1025,6 @@ ManagePasswordsBubbleView::ManagePasswordsBubbleView(
if (anchor_view)
anchor_view->SetActive(true);
mouse_handler_.reset(new WebContentMouseHandler(this));
-
- // Add observers to close the bubble if the fullscreen state changes.
- Browser* browser = chrome::FindBrowserWithWebContents(web_contents);
- registrar_.Add(
- this,
- chrome::NOTIFICATION_FULLSCREEN_CHANGED,
- content::Source<FullscreenController>(browser->fullscreen_controller()));
}
ManagePasswordsBubbleView::~ManagePasswordsBubbleView() {
@@ -1045,20 +1032,6 @@ ManagePasswordsBubbleView::~ManagePasswordsBubbleView() {
anchor_view_->SetActive(false);
}
-void ManagePasswordsBubbleView::AdjustForFullscreen(
- const gfx::Rect& screen_bounds) {
- if (GetAnchorView())
- return;
-
- // The bubble's padding from the screen edge, used in fullscreen.
- const int kFullscreenPaddingEnd = 20;
- const size_t bubble_half_width = width() / 2;
- const int x_pos = base::i18n::IsRTL() ?
- screen_bounds.x() + bubble_half_width + kFullscreenPaddingEnd :
- screen_bounds.right() - bubble_half_width - kFullscreenPaddingEnd;
- SetAnchorRect(gfx::Rect(x_pos, screen_bounds.y(), 0, 0));
-}
-
void ManagePasswordsBubbleView::Close() {
mouse_handler_.reset();
GetWidget()->Close();
@@ -1130,12 +1103,3 @@ void ManagePasswordsBubbleView::WindowClosing() {
views::View* ManagePasswordsBubbleView::GetInitiallyFocusedView() {
return initially_focused_view_;
}
-
-void ManagePasswordsBubbleView::Observe(
- int type,
- const content::NotificationSource& source,
- const content::NotificationDetails& details) {
- DCHECK_EQ(type, chrome::NOTIFICATION_FULLSCREEN_CHANGED);
- GetWidget()->SetVisibilityAnimationTransition(views::Widget::ANIMATE_NONE);
- CloseBubble();
-}

Powered by Google App Engine
This is Rietveld 408576698