| 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, |
| 215 0, |
| 216 1, |
| 217 0, |
| 218 GetNativeTheme()->GetSystemColor( |
| 215 ui::NativeTheme::kColorId_EnabledMenuButtonBorderColor))); | 219 ui::NativeTheme::kColorId_EnabledMenuButtonBorderColor))); |
| 216 layout->AddView(item); | 220 layout->AddView(item); |
| 217 | 221 |
| 218 const int kDoubleColumnSetId = 2; | 222 const int kDoubleColumnSetId = 2; |
| 219 views::ColumnSet* double_column_set = | 223 views::ColumnSet* double_column_set = |
| 220 layout->AddColumnSet(kDoubleColumnSetId); | 224 layout->AddColumnSet(kDoubleColumnSetId); |
| 221 double_column_set->AddPaddingColumn(0, views::kPanelHorizMargin); | 225 double_column_set->AddPaddingColumn(0, views::kPanelHorizMargin); |
| 222 double_column_set->AddColumn(GridLayout::TRAILING, GridLayout::CENTER, 1, | 226 double_column_set->AddColumn(GridLayout::TRAILING, GridLayout::CENTER, 1, |
| 223 GridLayout::USE_PREF, 0, 0); | 227 GridLayout::USE_PREF, 0, 0); |
| 224 double_column_set->AddPaddingColumn(0, views::kRelatedButtonHSpacing); | 228 double_column_set->AddPaddingColumn(0, views::kRelatedButtonHSpacing); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 | 264 |
| 261 if (!manage_passwords_bubble_model_->best_matches().empty()) { | 265 if (!manage_passwords_bubble_model_->best_matches().empty()) { |
| 262 for (autofill::PasswordFormMap::const_iterator i( | 266 for (autofill::PasswordFormMap::const_iterator i( |
| 263 manage_passwords_bubble_model_->best_matches().begin()); | 267 manage_passwords_bubble_model_->best_matches().begin()); |
| 264 i != manage_passwords_bubble_model_->best_matches().end(); ++i) { | 268 i != manage_passwords_bubble_model_->best_matches().end(); ++i) { |
| 265 layout->StartRow(0, kSingleColumnCredentialsId); | 269 layout->StartRow(0, kSingleColumnCredentialsId); |
| 266 ManagePasswordItemView* item = new ManagePasswordItemView( | 270 ManagePasswordItemView* item = new ManagePasswordItemView( |
| 267 manage_passwords_bubble_model_, *i->second, first_field_width, | 271 manage_passwords_bubble_model_, *i->second, first_field_width, |
| 268 second_field_width); | 272 second_field_width); |
| 269 if (i == manage_passwords_bubble_model_->best_matches().begin()) { | 273 if (i == manage_passwords_bubble_model_->best_matches().begin()) { |
| 270 item->set_border(views::Border::CreateSolidSidedBorder( | 274 item->SetBorder(views::Border::CreateSolidSidedBorder( |
| 271 1, 0, 1, 0, GetNativeTheme()->GetSystemColor( | 275 1, |
| 276 0, |
| 277 1, |
| 278 0, |
| 279 GetNativeTheme()->GetSystemColor( |
| 272 ui::NativeTheme::kColorId_EnabledMenuButtonBorderColor))); | 280 ui::NativeTheme::kColorId_EnabledMenuButtonBorderColor))); |
| 273 } else { | 281 } else { |
| 274 item->set_border(views::Border::CreateSolidSidedBorder( | 282 item->SetBorder(views::Border::CreateSolidSidedBorder( |
| 275 0, 0, 1, 0, GetNativeTheme()->GetSystemColor( | 283 0, |
| 284 0, |
| 285 1, |
| 286 0, |
| 287 GetNativeTheme()->GetSystemColor( |
| 276 ui::NativeTheme::kColorId_EnabledMenuButtonBorderColor))); | 288 ui::NativeTheme::kColorId_EnabledMenuButtonBorderColor))); |
| 277 } | 289 } |
| 278 layout->AddView(item); | 290 layout->AddView(item); |
| 279 } | 291 } |
| 280 } else if (!manage_passwords_bubble_model_->password_submitted()) { | 292 } else if (!manage_passwords_bubble_model_->password_submitted()) { |
| 281 views::Label* empty_label = new views::Label( | 293 views::Label* empty_label = new views::Label( |
| 282 l10n_util::GetStringUTF16(IDS_MANAGE_PASSWORDS_NO_PASSWORDS)); | 294 l10n_util::GetStringUTF16(IDS_MANAGE_PASSWORDS_NO_PASSWORDS)); |
| 283 empty_label->SetMultiLine(true); | 295 empty_label->SetMultiLine(true); |
| 284 layout->StartRow(0, kSingleColumnSetId); | 296 layout->StartRow(0, kSingleColumnSetId); |
| 285 layout->AddView(empty_label); | 297 layout->AddView(empty_label); |
| 286 } | 298 } |
| 287 | 299 |
| 288 if (manage_passwords_bubble_model_->password_submitted()) { | 300 if (manage_passwords_bubble_model_->password_submitted()) { |
| 289 layout->StartRow(0, kSingleColumnCredentialsId); | 301 layout->StartRow(0, kSingleColumnCredentialsId); |
| 290 ManagePasswordItemView* item = new ManagePasswordItemView( | 302 ManagePasswordItemView* item = new ManagePasswordItemView( |
| 291 manage_passwords_bubble_model_, | 303 manage_passwords_bubble_model_, |
| 292 manage_passwords_bubble_model_->pending_credentials(), | 304 manage_passwords_bubble_model_->pending_credentials(), |
| 293 first_field_width, second_field_width); | 305 first_field_width, second_field_width); |
| 294 if (manage_passwords_bubble_model_->best_matches().empty()) { | 306 if (manage_passwords_bubble_model_->best_matches().empty()) { |
| 295 item->set_border(views::Border::CreateSolidSidedBorder(1, 0, 1, 0, | 307 item->SetBorder(views::Border::CreateSolidSidedBorder( |
| 308 1, |
| 309 0, |
| 310 1, |
| 311 0, |
| 296 GetNativeTheme()->GetSystemColor( | 312 GetNativeTheme()->GetSystemColor( |
| 297 ui::NativeTheme::kColorId_EnabledMenuButtonBorderColor))); | 313 ui::NativeTheme::kColorId_EnabledMenuButtonBorderColor))); |
| 298 } else { | 314 } else { |
| 299 item->set_border(views::Border::CreateSolidSidedBorder(0, 0, 1, 0, | 315 item->SetBorder(views::Border::CreateSolidSidedBorder( |
| 316 0, |
| 317 0, |
| 318 1, |
| 319 0, |
| 300 GetNativeTheme()->GetSystemColor( | 320 GetNativeTheme()->GetSystemColor( |
| 301 ui::NativeTheme::kColorId_EnabledMenuButtonBorderColor))); | 321 ui::NativeTheme::kColorId_EnabledMenuButtonBorderColor))); |
| 302 } | 322 } |
| 303 layout->AddView(item); | 323 layout->AddView(item); |
| 304 } | 324 } |
| 305 | 325 |
| 306 manage_link_ = | 326 manage_link_ = |
| 307 new views::Link(manage_passwords_bubble_model_->manage_link()); | 327 new views::Link(manage_passwords_bubble_model_->manage_link()); |
| 308 manage_link_->set_listener(this); | 328 manage_link_->set_listener(this); |
| 309 layout->StartRowWithPadding(0, kSingleButtonSetId, | 329 layout->StartRowWithPadding(0, kSingleButtonSetId, |
| (...skipping 26 matching lines...) Expand all Loading... |
| 336 manage_passwords_bubble_model_->manage_passwords_bubble_state() == | 356 manage_passwords_bubble_model_->manage_passwords_bubble_state() == |
| 337 ManagePasswordsBubbleModel::PASSWORD_TO_BE_SAVED); | 357 ManagePasswordsBubbleModel::PASSWORD_TO_BE_SAVED); |
| 338 Close(); | 358 Close(); |
| 339 } | 359 } |
| 340 | 360 |
| 341 void ManagePasswordsBubbleView::LinkClicked(views::Link* source, | 361 void ManagePasswordsBubbleView::LinkClicked(views::Link* source, |
| 342 int event_flags) { | 362 int event_flags) { |
| 343 DCHECK_EQ(source, manage_link_); | 363 DCHECK_EQ(source, manage_link_); |
| 344 manage_passwords_bubble_model_->OnManageLinkClicked(); | 364 manage_passwords_bubble_model_->OnManageLinkClicked(); |
| 345 } | 365 } |
| OLD | NEW |