Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_ui_controller.h" | 5 #include "chrome/browser/ui/passwords/manage_passwords_ui_controller.h" |
| 6 | 6 |
| 7 #include "chrome/app/chrome_command_ids.h" | 7 #include "chrome/app/chrome_command_ids.h" |
| 8 #include "chrome/browser/browsing_data/browsing_data_helper.h" | 8 #include "chrome/browser/browsing_data/browsing_data_helper.h" |
| 9 #include "chrome/browser/password_manager/password_store_factory.h" | 9 #include "chrome/browser/password_manager/password_store_factory.h" |
| 10 #include "chrome/browser/ui/browser_command_controller.h" | 10 #include "chrome/browser/ui/browser_command_controller.h" |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 85 #if !defined(OS_ANDROID) | 85 #if !defined(OS_ANDROID) |
| 86 Browser* browser = chrome::FindBrowserWithWebContents(web_contents()); | 86 Browser* browser = chrome::FindBrowserWithWebContents(web_contents()); |
| 87 if (!browser) | 87 if (!browser) |
| 88 return; | 88 return; |
| 89 LocationBar* location_bar = browser->window()->GetLocationBar(); | 89 LocationBar* location_bar = browser->window()->GetLocationBar(); |
| 90 DCHECK(location_bar); | 90 DCHECK(location_bar); |
| 91 location_bar->UpdateManagePasswordsIconAndBubble(); | 91 location_bar->UpdateManagePasswordsIconAndBubble(); |
| 92 #endif | 92 #endif |
| 93 } | 93 } |
| 94 | 94 |
| 95 void ManagePasswordsUIController::OnAskToReportURL(const std::string& host) { | |
| 96 origin_ = GURL("http://" + host); | |
|
vabr (Chromium)
2014/12/03 14:08:06
Why do you assume that the scheme is HTTP? It coul
melandory
2014/12/04 10:33:47
I've added "http" in order to form proper GURL and
| |
| 97 state_ = password_manager::ui::ASK_SUBMIT_URL_AND_BUBBLE_STATE; | |
| 98 UpdateBubbleAndIconVisibility(); | |
| 99 } | |
| 100 | |
| 95 void ManagePasswordsUIController::OnPasswordSubmitted( | 101 void ManagePasswordsUIController::OnPasswordSubmitted( |
| 96 scoped_ptr<PasswordFormManager> form_manager) { | 102 scoped_ptr<PasswordFormManager> form_manager) { |
| 97 form_manager_ = form_manager.Pass(); | 103 form_manager_ = form_manager.Pass(); |
| 98 password_form_map_ = ConstifyMap(form_manager_->best_matches()); | 104 password_form_map_ = ConstifyMap(form_manager_->best_matches()); |
| 99 origin_ = PendingPassword().origin; | 105 origin_ = PendingPassword().origin; |
| 100 state_ = password_manager::ui::PENDING_PASSWORD_AND_BUBBLE_STATE; | 106 state_ = password_manager::ui::PENDING_PASSWORD_AND_BUBBLE_STATE; |
| 101 UpdateBubbleAndIconVisibility(); | 107 UpdateBubbleAndIconVisibility(); |
| 102 } | 108 } |
| 103 | 109 |
| 104 bool ManagePasswordsUIController::OnChooseCredentials( | 110 bool ManagePasswordsUIController::OnChooseCredentials( |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 244 const content::FrameNavigateParams& params) { | 250 const content::FrameNavigateParams& params) { |
| 245 // Don't react to in-page (fragment) navigations. | 251 // Don't react to in-page (fragment) navigations. |
| 246 if (details.is_in_page) | 252 if (details.is_in_page) |
| 247 return; | 253 return; |
| 248 | 254 |
| 249 // Don't do anything if a navigation occurs before a user could reasonably | 255 // Don't do anything if a navigation occurs before a user could reasonably |
| 250 // interact with the password bubble. | 256 // interact with the password bubble. |
| 251 if (timer_ && timer_->Elapsed() < base::TimeDelta::FromSeconds(1)) | 257 if (timer_ && timer_->Elapsed() < base::TimeDelta::FromSeconds(1)) |
| 252 return; | 258 return; |
| 253 | 259 |
| 260 // This allows "Allow to collect URL?" bubble to leave 1 page longer. | |
|
vabr (Chromium)
2014/12/03 14:08:06
typo: leave -> live (?)
Also, "1 page longer" soun
melandory
2014/12/04 10:33:46
Done.
| |
| 261 if (state_ == password_manager::ui::ASK_SUBMIT_URL_STATE) { | |
| 262 // TODO(melandory): Substitude this with proper solution using | |
|
vabr (Chromium)
2014/12/03 14:08:06
typo: Substitude -> Substitute
Also: proper soluti
melandory
2014/12/04 10:33:46
Done. Also "setlocal spell spelllang=en_us" IS now
| |
| 263 // provisional_save_manager. | |
| 264 state_ = password_manager::ui::ASK_SUBMIT_URL_AND_BUBBLE_STATE; | |
| 265 return; | |
| 266 } | |
| 267 | |
| 254 // Otherwise, reset the password manager and the timer. | 268 // Otherwise, reset the password manager and the timer. |
| 255 state_ = password_manager::ui::INACTIVE_STATE; | 269 state_ = password_manager::ui::INACTIVE_STATE; |
| 256 UpdateBubbleAndIconVisibility(); | 270 UpdateBubbleAndIconVisibility(); |
| 257 timer_.reset(new base::ElapsedTimer()); | 271 timer_.reset(new base::ElapsedTimer()); |
| 258 } | 272 } |
| 259 | 273 |
| 260 void ManagePasswordsUIController::WasHidden() { | 274 void ManagePasswordsUIController::WasHidden() { |
| 261 #if !defined(OS_ANDROID) | 275 #if !defined(OS_ANDROID) |
| 262 chrome::CloseManagePasswordsBubble(web_contents()); | 276 chrome::CloseManagePasswordsBubble(web_contents()); |
| 263 #endif | 277 #endif |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 309 bool ManagePasswordsUIController::PasswordPendingUserDecision() const { | 323 bool ManagePasswordsUIController::PasswordPendingUserDecision() const { |
| 310 return password_manager::ui::IsPendingState(state_); | 324 return password_manager::ui::IsPendingState(state_); |
| 311 } | 325 } |
| 312 | 326 |
| 313 void ManagePasswordsUIController::WebContentsDestroyed() { | 327 void ManagePasswordsUIController::WebContentsDestroyed() { |
| 314 password_manager::PasswordStore* password_store = | 328 password_manager::PasswordStore* password_store = |
| 315 GetPasswordStore(web_contents()); | 329 GetPasswordStore(web_contents()); |
| 316 if (password_store) | 330 if (password_store) |
| 317 password_store->RemoveObserver(this); | 331 password_store->RemoveObserver(this); |
| 318 } | 332 } |
| OLD | NEW |