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

Side by Side Diff: chrome/browser/ui/passwords/manage_passwords_bubble_model.cc

Issue 839193002: Move ServiceAccessType into //components/keyed_service (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix compilation on android Created 5 years, 11 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
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/passwords/manage_passwords_bubble_model.h" 5 #include "chrome/browser/ui/passwords/manage_passwords_bubble_model.h"
6 6
7 #include "chrome/browser/password_manager/password_store_factory.h" 7 #include "chrome/browser/password_manager/password_store_factory.h"
8 #include "chrome/browser/profiles/profile.h"
8 #include "chrome/browser/ui/browser.h" 9 #include "chrome/browser/ui/browser.h"
9 #include "chrome/browser/ui/browser_finder.h" 10 #include "chrome/browser/ui/browser_finder.h"
10 #include "chrome/browser/ui/passwords/manage_passwords_ui_controller.h" 11 #include "chrome/browser/ui/passwords/manage_passwords_ui_controller.h"
11 #include "chrome/browser/ui/passwords/password_bubble_experiment.h" 12 #include "chrome/browser/ui/passwords/password_bubble_experiment.h"
12 #include "chrome/grit/generated_resources.h" 13 #include "chrome/grit/generated_resources.h"
13 #include "components/feedback/feedback_data.h" 14 #include "components/feedback/feedback_data.h"
14 #include "components/feedback/feedback_util.h" 15 #include "components/feedback/feedback_util.h"
15 #include "components/password_manager/core/browser/password_manager_url_collecti on_experiment.h" 16 #include "components/password_manager/core/browser/password_manager_url_collecti on_experiment.h"
16 #include "components/password_manager/core/browser/password_store.h" 17 #include "components/password_manager/core/browser/password_store.h"
17 #include "components/password_manager/core/common/password_manager_ui.h" 18 #include "components/password_manager/core/common/password_manager_ui.h"
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 } 300 }
300 301
301 void ManagePasswordsBubbleModel::OnPasswordAction( 302 void ManagePasswordsBubbleModel::OnPasswordAction(
302 const autofill::PasswordForm& password_form, 303 const autofill::PasswordForm& password_form,
303 PasswordAction action) { 304 PasswordAction action) {
304 if (!web_contents()) 305 if (!web_contents())
305 return; 306 return;
306 Profile* profile = 307 Profile* profile =
307 Profile::FromBrowserContext(web_contents()->GetBrowserContext()); 308 Profile::FromBrowserContext(web_contents()->GetBrowserContext());
308 password_manager::PasswordStore* password_store = 309 password_manager::PasswordStore* password_store =
309 PasswordStoreFactory::GetForProfile(profile, Profile::EXPLICIT_ACCESS) 310 PasswordStoreFactory::GetForProfile(
310 .get(); 311 profile, ServiceAccessType::EXPLICIT_ACCESS).get();
311 DCHECK(password_store); 312 DCHECK(password_store);
312 if (action == REMOVE_PASSWORD) 313 if (action == REMOVE_PASSWORD)
313 password_store->RemoveLogin(password_form); 314 password_store->RemoveLogin(password_form);
314 else 315 else
315 password_store->AddLogin(password_form); 316 password_store->AddLogin(password_form);
316 } 317 }
317 318
318 void ManagePasswordsBubbleModel::OnChooseCredentials( 319 void ManagePasswordsBubbleModel::OnChooseCredentials(
319 const autofill::PasswordForm& password_form) { 320 const autofill::PasswordForm& password_form) {
320 dismissal_reason_ = metrics_util::CLICKED_CREDENTIAL; 321 dismissal_reason_ = metrics_util::CLICKED_CREDENTIAL;
321 RecordExperimentStatistics(web_contents(), dismissal_reason_); 322 RecordExperimentStatistics(web_contents(), dismissal_reason_);
322 ManagePasswordsUIController* manage_passwords_ui_controller = 323 ManagePasswordsUIController* manage_passwords_ui_controller =
323 ManagePasswordsUIController::FromWebContents(web_contents()); 324 ManagePasswordsUIController::FromWebContents(web_contents());
324 manage_passwords_ui_controller->ChooseCredential(true, password_form); 325 manage_passwords_ui_controller->ChooseCredential(true, password_form);
325 state_ = password_manager::ui::INACTIVE_STATE; 326 state_ = password_manager::ui::INACTIVE_STATE;
326 } 327 }
327 328
328 // static 329 // static
329 int ManagePasswordsBubbleModel::UsernameFieldWidth() { 330 int ManagePasswordsBubbleModel::UsernameFieldWidth() {
330 return GetFieldWidth(USERNAME_FIELD); 331 return GetFieldWidth(USERNAME_FIELD);
331 } 332 }
332 333
333 // static 334 // static
334 int ManagePasswordsBubbleModel::PasswordFieldWidth() { 335 int ManagePasswordsBubbleModel::PasswordFieldWidth() {
335 return GetFieldWidth(PASSWORD_FIELD); 336 return GetFieldWidth(PASSWORD_FIELD);
336 } 337 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/omnibox/omnibox_view_browsertest.cc ('k') | chrome/browser/ui/passwords/manage_passwords_ui_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698