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

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

Issue 259153004: Password bubble: Give users the option of unblacklisting a site. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 7 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 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 parent_->Close(); 268 parent_->Close();
269 } 269 }
270 270
271 void ManagePasswordsBubbleView::ManageView::LinkClicked(views::Link* source, 271 void ManagePasswordsBubbleView::ManageView::LinkClicked(views::Link* source,
272 int event_flags) { 272 int event_flags) {
273 DCHECK_EQ(source, manage_link_); 273 DCHECK_EQ(source, manage_link_);
274 parent_->model()->OnManageLinkClicked(); 274 parent_->model()->OnManageLinkClicked();
275 parent_->Close(); 275 parent_->Close();
276 } 276 }
277 277
278 // ManagePasswordsBubbleView::BlacklistedView ---------------------------------
279
280 ManagePasswordsBubbleView::BlacklistedView::BlacklistedView(
281 ManagePasswordsBubbleView* parent)
282 : parent_(parent) {
283 views::GridLayout* layout = new views::GridLayout(this);
284 SetLayoutManager(layout);
285
286 // Add the title.
287 BuildColumnSet(layout, SINGLE_VIEW_COLUMN_SET);
288 AddTitleRow(layout, parent_->model());
289
290 // Add the "Hey! You blacklisted this site!" text.
291 layout->StartRow(0, SINGLE_VIEW_COLUMN_SET);
292 views::Label* blacklisted = new views::Label(
293 l10n_util::GetStringUTF16(IDS_MANAGE_PASSWORDS_BLACKLISTED));
294 blacklisted->SetMultiLine(true);
295 layout->AddView(blacklisted);
296
297 // Then add the "enable password manager" and "Done" buttons.
298 unblacklist_button_ = new views::BlueButton(
299 this, l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_UNBLACKLIST_BUTTON));
300 done_button_ =
301 new views::LabelButton(this, l10n_util::GetStringUTF16(IDS_DONE));
302 done_button_->SetStyle(views::Button::STYLE_BUTTON);
303
304 BuildColumnSet(layout, DOUBLE_BUTTON_COLUMN_SET);
305 layout->StartRowWithPadding(
306 0, DOUBLE_BUTTON_COLUMN_SET, 0, views::kRelatedControlVerticalSpacing);
307 layout->AddView(unblacklist_button_);
308 layout->AddView(done_button_);
309
310 // Extra padding for visual awesomeness.
311 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing);
312 }
313
314 ManagePasswordsBubbleView::BlacklistedView::~BlacklistedView() {
315 }
316
317 void ManagePasswordsBubbleView::BlacklistedView::ButtonPressed(
318 views::Button* sender,
319 const ui::Event& event) {
320 if (sender == done_button_)
321 parent_->model()->OnDoneClicked();
322 else if (sender == unblacklist_button_)
323 parent_->model()->OnUnblacklistClicked();
324 else
325 NOTREACHED();
326 parent_->Close();
327 }
278 328
279 // ManagePasswordsBubbleView -------------------------------------------------- 329 // ManagePasswordsBubbleView --------------------------------------------------
280 330
281 // static 331 // static
282 ManagePasswordsBubbleView* ManagePasswordsBubbleView::manage_passwords_bubble_ = 332 ManagePasswordsBubbleView* ManagePasswordsBubbleView::manage_passwords_bubble_ =
283 NULL; 333 NULL;
284 334
285 // static 335 // static
286 void ManagePasswordsBubbleView::ShowBubble(content::WebContents* web_contents, 336 void ManagePasswordsBubbleView::ShowBubble(content::WebContents* web_contents,
287 DisplayReason reason) { 337 DisplayReason reason) {
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 GetWidget()->Close(); 417 GetWidget()->Close();
368 } 418 }
369 419
370 void ManagePasswordsBubbleView::Init() { 420 void ManagePasswordsBubbleView::Init() {
371 views::FillLayout* layout = new views::FillLayout(); 421 views::FillLayout* layout = new views::FillLayout();
372 SetLayoutManager(layout); 422 SetLayoutManager(layout);
373 SetFocusable(true); 423 SetFocusable(true);
374 424
375 if (model()->WaitingToSavePassword()) 425 if (model()->WaitingToSavePassword())
376 AddChildView(new PendingView(this)); 426 AddChildView(new PendingView(this));
427 else if (model()->NeverSavingPasswords())
428 AddChildView(new BlacklistedView(this));
377 else 429 else
378 AddChildView(new ManageView(this)); 430 AddChildView(new ManageView(this));
379 } 431 }
380 432
381 void ManagePasswordsBubbleView::WindowClosing() { 433 void ManagePasswordsBubbleView::WindowClosing() {
382 // Close() closes the window asynchronously, so by the time we reach here, 434 // Close() closes the window asynchronously, so by the time we reach here,
383 // |manage_passwords_bubble_| may have already been reset. 435 // |manage_passwords_bubble_| may have already been reset.
384 if (manage_passwords_bubble_ == this) 436 if (manage_passwords_bubble_ == this)
385 manage_passwords_bubble_ = NULL; 437 manage_passwords_bubble_ = NULL;
386 } 438 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698