OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/autofill/autofill_manager.h" | 5 #include "chrome/browser/autofill/autofill_manager.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 } // namespace | 93 } // namespace |
94 | 94 |
95 // TODO(jhawkins): Maybe this should be in a grd file? | 95 // TODO(jhawkins): Maybe this should be in a grd file? |
96 const char* kAutoFillLearnMoreUrl = | 96 const char* kAutoFillLearnMoreUrl = |
97 "http://www.google.com/support/chrome/bin/answer.py?answer=142893"; | 97 "http://www.google.com/support/chrome/bin/answer.py?answer=142893"; |
98 | 98 |
99 AutoFillManager::AutoFillManager(TabContents* tab_contents) | 99 AutoFillManager::AutoFillManager(TabContents* tab_contents) |
100 : tab_contents_(tab_contents), | 100 : tab_contents_(tab_contents), |
101 personal_data_(NULL), | 101 personal_data_(NULL), |
102 download_manager_(tab_contents_->profile()), | 102 download_manager_(tab_contents_->profile()), |
103 disable_download_manager_requests_(false) { | 103 disable_download_manager_requests_(false), |
| 104 cc_infobar_(NULL) { |
104 DCHECK(tab_contents); | 105 DCHECK(tab_contents); |
105 | 106 |
106 // |personal_data_| is NULL when using TestTabContents. | 107 // |personal_data_| is NULL when using TestTabContents. |
107 personal_data_ = | 108 personal_data_ = |
108 tab_contents_->profile()->GetOriginalProfile()->GetPersonalDataManager(); | 109 tab_contents_->profile()->GetOriginalProfile()->GetPersonalDataManager(); |
109 download_manager_.SetObserver(this); | 110 download_manager_.SetObserver(this); |
110 } | 111 } |
111 | 112 |
112 AutoFillManager::~AutoFillManager() { | 113 AutoFillManager::~AutoFillManager() { |
113 download_manager_.SetObserver(NULL); | 114 download_manager_.SetObserver(NULL); |
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
473 void AutoFillManager::OnInfoBarClosed(bool should_save) { | 474 void AutoFillManager::OnInfoBarClosed(bool should_save) { |
474 if (should_save) | 475 if (should_save) |
475 personal_data_->SaveImportedCreditCard(); | 476 personal_data_->SaveImportedCreditCard(); |
476 UploadFormData(); | 477 UploadFormData(); |
477 } | 478 } |
478 | 479 |
479 AutoFillManager::AutoFillManager() | 480 AutoFillManager::AutoFillManager() |
480 : tab_contents_(NULL), | 481 : tab_contents_(NULL), |
481 personal_data_(NULL), | 482 personal_data_(NULL), |
482 download_manager_(NULL), | 483 download_manager_(NULL), |
483 disable_download_manager_requests_(false) { | 484 disable_download_manager_requests_(false), |
| 485 cc_infobar_(NULL) { |
484 } | 486 } |
485 | 487 |
486 AutoFillManager::AutoFillManager(TabContents* tab_contents, | 488 AutoFillManager::AutoFillManager(TabContents* tab_contents, |
487 PersonalDataManager* personal_data) | 489 PersonalDataManager* personal_data) |
488 : tab_contents_(tab_contents), | 490 : tab_contents_(tab_contents), |
489 personal_data_(personal_data), | 491 personal_data_(personal_data), |
490 download_manager_(NULL), | 492 download_manager_(NULL), |
491 disable_download_manager_requests_(false) { | 493 disable_download_manager_requests_(false), |
| 494 cc_infobar_(NULL) { |
492 DCHECK(tab_contents); | 495 DCHECK(tab_contents); |
493 } | 496 } |
494 | 497 |
495 void AutoFillManager::GetProfileSuggestions(FormStructure* form, | 498 void AutoFillManager::GetProfileSuggestions(FormStructure* form, |
496 const FormField& field, | 499 const FormField& field, |
497 AutoFillType type, | 500 AutoFillType type, |
498 bool include_cc_labels, | 501 bool include_cc_labels, |
499 std::vector<string16>* values, | 502 std::vector<string16>* values, |
500 std::vector<string16>* labels, | 503 std::vector<string16>* labels, |
501 std::vector<string16>* icons, | 504 std::vector<string16>* icons, |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
806 | 809 |
807 // When receiving IDs (across processes) from the renderer we unpack credit card | 810 // When receiving IDs (across processes) from the renderer we unpack credit card |
808 // and profile IDs from a single integer. Credit card IDs are stored in the | 811 // and profile IDs from a single integer. Credit card IDs are stored in the |
809 // high word and profile IDs are stored in the low word. | 812 // high word and profile IDs are stored in the low word. |
810 // static | 813 // static |
811 void AutoFillManager::UnpackIDs(int id, int* cc_id, int* profile_id) { | 814 void AutoFillManager::UnpackIDs(int id, int* cc_id, int* profile_id) { |
812 *cc_id = id >> std::numeric_limits<unsigned short>::digits & | 815 *cc_id = id >> std::numeric_limits<unsigned short>::digits & |
813 std::numeric_limits<unsigned short>::max(); | 816 std::numeric_limits<unsigned short>::max(); |
814 *profile_id = id & std::numeric_limits<unsigned short>::max(); | 817 *profile_id = id & std::numeric_limits<unsigned short>::max(); |
815 } | 818 } |
OLD | NEW |