| 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 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 single_column->AddPaddingColumn(0, views::kPanelHorizMargin); | 203 single_column->AddPaddingColumn(0, views::kPanelHorizMargin); |
| 204 single_column->AddColumn(GridLayout::FILL, GridLayout::FILL, 1, | 204 single_column->AddColumn(GridLayout::FILL, GridLayout::FILL, 1, |
| 205 GridLayout::USE_PREF, 0, 0); | 205 GridLayout::USE_PREF, 0, 0); |
| 206 single_column->AddPaddingColumn(0, views::kPanelHorizMargin); | 206 single_column->AddPaddingColumn(0, views::kPanelHorizMargin); |
| 207 | 207 |
| 208 layout->StartRow(0, kSingleColumnCredentialsId); | 208 layout->StartRow(0, kSingleColumnCredentialsId); |
| 209 ManagePasswordItemView* item = new ManagePasswordItemView( | 209 ManagePasswordItemView* item = new ManagePasswordItemView( |
| 210 manage_passwords_bubble_model_, | 210 manage_passwords_bubble_model_, |
| 211 manage_passwords_bubble_model_->pending_credentials(), | 211 manage_passwords_bubble_model_->pending_credentials(), |
| 212 first_field_width, second_field_width); | 212 first_field_width, second_field_width); |
| 213 item->set_border(views::Border::CreateSolidSidedBorder( | 213 item->SetBorder(views::Border::CreateSolidSidedBorder( |
| 214 1, 0, 1, 0, GetNativeTheme()->GetSystemColor( | 214 1, 0, 1, 0, GetNativeTheme()->GetSystemColor( |
| 215 ui::NativeTheme::kColorId_EnabledMenuButtonBorderColor))); | 215 ui::NativeTheme::kColorId_EnabledMenuButtonBorderColor))); |
| 216 layout->AddView(item); | 216 layout->AddView(item); |
| 217 | 217 |
| 218 const int kDoubleColumnSetId = 2; | 218 const int kDoubleColumnSetId = 2; |
| 219 views::ColumnSet* double_column_set = | 219 views::ColumnSet* double_column_set = |
| 220 layout->AddColumnSet(kDoubleColumnSetId); | 220 layout->AddColumnSet(kDoubleColumnSetId); |
| 221 double_column_set->AddPaddingColumn(0, views::kPanelHorizMargin); | 221 double_column_set->AddPaddingColumn(0, views::kPanelHorizMargin); |
| 222 double_column_set->AddColumn(GridLayout::TRAILING, GridLayout::CENTER, 1, | 222 double_column_set->AddColumn(GridLayout::TRAILING, GridLayout::CENTER, 1, |
| 223 GridLayout::USE_PREF, 0, 0); | 223 GridLayout::USE_PREF, 0, 0); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 | 260 |
| 261 if (!manage_passwords_bubble_model_->best_matches().empty()) { | 261 if (!manage_passwords_bubble_model_->best_matches().empty()) { |
| 262 for (autofill::PasswordFormMap::const_iterator i( | 262 for (autofill::PasswordFormMap::const_iterator i( |
| 263 manage_passwords_bubble_model_->best_matches().begin()); | 263 manage_passwords_bubble_model_->best_matches().begin()); |
| 264 i != manage_passwords_bubble_model_->best_matches().end(); ++i) { | 264 i != manage_passwords_bubble_model_->best_matches().end(); ++i) { |
| 265 layout->StartRow(0, kSingleColumnCredentialsId); | 265 layout->StartRow(0, kSingleColumnCredentialsId); |
| 266 ManagePasswordItemView* item = new ManagePasswordItemView( | 266 ManagePasswordItemView* item = new ManagePasswordItemView( |
| 267 manage_passwords_bubble_model_, *i->second, first_field_width, | 267 manage_passwords_bubble_model_, *i->second, first_field_width, |
| 268 second_field_width); | 268 second_field_width); |
| 269 if (i == manage_passwords_bubble_model_->best_matches().begin()) { | 269 if (i == manage_passwords_bubble_model_->best_matches().begin()) { |
| 270 item->set_border(views::Border::CreateSolidSidedBorder( | 270 item->SetBorder(views::Border::CreateSolidSidedBorder( |
| 271 1, 0, 1, 0, GetNativeTheme()->GetSystemColor( | 271 1, 0, 1, 0, GetNativeTheme()->GetSystemColor( |
| 272 ui::NativeTheme::kColorId_EnabledMenuButtonBorderColor))); | 272 ui::NativeTheme::kColorId_EnabledMenuButtonBorderColor))); |
| 273 } else { | 273 } else { |
| 274 item->set_border(views::Border::CreateSolidSidedBorder( | 274 item->SetBorder(views::Border::CreateSolidSidedBorder( |
| 275 0, 0, 1, 0, GetNativeTheme()->GetSystemColor( | 275 0, 0, 1, 0, GetNativeTheme()->GetSystemColor( |
| 276 ui::NativeTheme::kColorId_EnabledMenuButtonBorderColor))); | 276 ui::NativeTheme::kColorId_EnabledMenuButtonBorderColor))); |
| 277 } | 277 } |
| 278 layout->AddView(item); | 278 layout->AddView(item); |
| 279 } | 279 } |
| 280 } else if (!manage_passwords_bubble_model_->password_submitted()) { | 280 } else if (!manage_passwords_bubble_model_->password_submitted()) { |
| 281 views::Label* empty_label = new views::Label( | 281 views::Label* empty_label = new views::Label( |
| 282 l10n_util::GetStringUTF16(IDS_MANAGE_PASSWORDS_NO_PASSWORDS)); | 282 l10n_util::GetStringUTF16(IDS_MANAGE_PASSWORDS_NO_PASSWORDS)); |
| 283 empty_label->SetMultiLine(true); | 283 empty_label->SetMultiLine(true); |
| 284 layout->StartRow(0, kSingleColumnSetId); | 284 layout->StartRow(0, kSingleColumnSetId); |
| 285 layout->AddView(empty_label); | 285 layout->AddView(empty_label); |
| 286 } | 286 } |
| 287 | 287 |
| 288 if (manage_passwords_bubble_model_->password_submitted()) { | 288 if (manage_passwords_bubble_model_->password_submitted()) { |
| 289 layout->StartRow(0, kSingleColumnCredentialsId); | 289 layout->StartRow(0, kSingleColumnCredentialsId); |
| 290 ManagePasswordItemView* item = new ManagePasswordItemView( | 290 ManagePasswordItemView* item = new ManagePasswordItemView( |
| 291 manage_passwords_bubble_model_, | 291 manage_passwords_bubble_model_, |
| 292 manage_passwords_bubble_model_->pending_credentials(), | 292 manage_passwords_bubble_model_->pending_credentials(), |
| 293 first_field_width, second_field_width); | 293 first_field_width, second_field_width); |
| 294 if (manage_passwords_bubble_model_->best_matches().empty()) { | 294 if (manage_passwords_bubble_model_->best_matches().empty()) { |
| 295 item->set_border(views::Border::CreateSolidSidedBorder(1, 0, 1, 0, | 295 item->SetBorder(views::Border::CreateSolidSidedBorder(1, 0, 1, 0, |
| 296 GetNativeTheme()->GetSystemColor( | 296 GetNativeTheme()->GetSystemColor( |
| 297 ui::NativeTheme::kColorId_EnabledMenuButtonBorderColor))); | 297 ui::NativeTheme::kColorId_EnabledMenuButtonBorderColor))); |
| 298 } else { | 298 } else { |
| 299 item->set_border(views::Border::CreateSolidSidedBorder(0, 0, 1, 0, | 299 item->SetBorder(views::Border::CreateSolidSidedBorder(0, 0, 1, 0, |
| 300 GetNativeTheme()->GetSystemColor( | 300 GetNativeTheme()->GetSystemColor( |
| 301 ui::NativeTheme::kColorId_EnabledMenuButtonBorderColor))); | 301 ui::NativeTheme::kColorId_EnabledMenuButtonBorderColor))); |
| 302 } | 302 } |
| 303 layout->AddView(item); | 303 layout->AddView(item); |
| 304 } | 304 } |
| 305 | 305 |
| 306 manage_link_ = | 306 manage_link_ = |
| 307 new views::Link(manage_passwords_bubble_model_->manage_link()); | 307 new views::Link(manage_passwords_bubble_model_->manage_link()); |
| 308 manage_link_->set_listener(this); | 308 manage_link_->set_listener(this); |
| 309 layout->StartRowWithPadding(0, kSingleButtonSetId, | 309 layout->StartRowWithPadding(0, kSingleButtonSetId, |
| (...skipping 26 matching lines...) Expand all Loading... |
| 336 manage_passwords_bubble_model_->manage_passwords_bubble_state() == | 336 manage_passwords_bubble_model_->manage_passwords_bubble_state() == |
| 337 ManagePasswordsBubbleModel::PASSWORD_TO_BE_SAVED); | 337 ManagePasswordsBubbleModel::PASSWORD_TO_BE_SAVED); |
| 338 Close(); | 338 Close(); |
| 339 } | 339 } |
| 340 | 340 |
| 341 void ManagePasswordsBubbleView::LinkClicked(views::Link* source, | 341 void ManagePasswordsBubbleView::LinkClicked(views::Link* source, |
| 342 int event_flags) { | 342 int event_flags) { |
| 343 DCHECK_EQ(source, manage_link_); | 343 DCHECK_EQ(source, manage_link_); |
| 344 manage_passwords_bubble_model_->OnManageLinkClicked(); | 344 manage_passwords_bubble_model_->OnManageLinkClicked(); |
| 345 } | 345 } |
| OLD | NEW |