| OLD | NEW |
| 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 22 matching lines...) Expand all Loading... |
| 33 const int kMaxDisplayableStringWidth = 22; | 33 const int kMaxDisplayableStringWidth = 22; |
| 34 | 34 |
| 35 // Returns the width of |password_form|'s |type| field, clamped to the maximum | 35 // Returns the width of |password_form|'s |type| field, clamped to the maximum |
| 36 // displayable string width. | 36 // displayable string width. |
| 37 int GetFieldWidth(const autofill::PasswordForm& password_form, | 37 int GetFieldWidth(const autofill::PasswordForm& password_form, |
| 38 ManagePasswordsBubbleView::FieldType type) { | 38 ManagePasswordsBubbleView::FieldType type) { |
| 39 const gfx::FontList font_list; | 39 const gfx::FontList font_list; |
| 40 base::string16 display_string( | 40 base::string16 display_string( |
| 41 type == ManagePasswordsBubbleView::USERNAME_FIELD | 41 type == ManagePasswordsBubbleView::USERNAME_FIELD |
| 42 ? password_form.username_value | 42 ? password_form.username_value |
| 43 : ManagePasswordItemView::GetPasswordDisplayString( | 43 : ManagePasswordItemView::GetPasswordDisplayString()); |
| 44 password_form.password_value)); | |
| 45 return std::min( | 44 return std::min( |
| 46 gfx::FontList().GetExpectedTextWidth(kMaxDisplayableStringWidth), | 45 gfx::FontList().GetExpectedTextWidth(kMaxDisplayableStringWidth), |
| 47 gfx::GetStringWidth(display_string, font_list)); | 46 gfx::GetStringWidth(display_string, font_list)); |
| 48 } | 47 } |
| 49 | 48 |
| 50 } // namespace | 49 } // namespace |
| 51 | 50 |
| 52 | 51 |
| 53 // ManagePasswordsBubbleView -------------------------------------------------- | 52 // ManagePasswordsBubbleView -------------------------------------------------- |
| 54 | 53 |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 manage_passwords_bubble_model_->manage_passwords_bubble_state() == | 356 manage_passwords_bubble_model_->manage_passwords_bubble_state() == |
| 358 ManagePasswordsBubbleModel::PASSWORD_TO_BE_SAVED); | 357 ManagePasswordsBubbleModel::PASSWORD_TO_BE_SAVED); |
| 359 Close(); | 358 Close(); |
| 360 } | 359 } |
| 361 | 360 |
| 362 void ManagePasswordsBubbleView::LinkClicked(views::Link* source, | 361 void ManagePasswordsBubbleView::LinkClicked(views::Link* source, |
| 363 int event_flags) { | 362 int event_flags) { |
| 364 DCHECK_EQ(source, manage_link_); | 363 DCHECK_EQ(source, manage_link_); |
| 365 manage_passwords_bubble_model_->OnManageLinkClicked(); | 364 manage_passwords_bubble_model_->OnManageLinkClicked(); |
| 366 } | 365 } |
| OLD | NEW |