summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/automation/testing_automation_provider.cc8
-rw-r--r--chrome/browser/first_run/first_run.cc2
-rw-r--r--chrome/browser/importer/importer_list.cc16
-rw-r--r--chrome/browser/importer/importer_list.h7
-rw-r--r--chrome/browser/ui/webui/options/import_data_handler.cc3
5 files changed, 11 insertions, 25 deletions
diff --git a/chrome/browser/automation/testing_automation_provider.cc b/chrome/browser/automation/testing_automation_provider.cc
index c258cdd..382ba9f 100644
--- a/chrome/browser/automation/testing_automation_provider.cc
+++ b/chrome/browser/automation/testing_automation_provider.cc
@@ -154,9 +154,9 @@ void TestingAutomationProvider::SourceProfilesLoaded() {
// Get the correct profile based on the browser the user provided.
importer::SourceProfile source_profile;
- int num_browsers = importer_list_->GetAvailableProfileCount();
- int i = 0;
- for ( ; i < num_browsers; i++) {
+ size_t i = 0;
+ size_t importers_count = importer_list_->count();
+ for ( ; i < importers_count; ++i) {
importer::SourceProfile profile = importer_list_->GetSourceProfileAt(i);
if (profile.importer_name == import_settings_data_.browser_name) {
source_profile = profile;
@@ -164,7 +164,7 @@ void TestingAutomationProvider::SourceProfilesLoaded() {
}
}
// If we made it to the end of the loop, then the input was bad.
- if (i == num_browsers) {
+ if (i == importers_count) {
AutomationJSONReply(this, import_settings_data_.reply_message)
.SendError("Invalid browser name string found.");
return;
diff --git a/chrome/browser/first_run/first_run.cc b/chrome/browser/first_run/first_run.cc
index 9cc2e16..d772ca0 100644
--- a/chrome/browser/first_run/first_run.cc
+++ b/chrome/browser/first_run/first_run.cc
@@ -521,7 +521,7 @@ void FirstRun::AutoImport(
importer_list->DetectSourceProfilesHack();
// Do import if there is an available profile for us to import.
- if (importer_list->GetAvailableProfileCount() > 0) {
+ if (importer_list->count() > 0) {
// Don't show the warning dialog if import fails.
importer_host->set_headless();
int items = 0;
diff --git a/chrome/browser/importer/importer_list.cc b/chrome/browser/importer/importer_list.cc
index 6deb6c3..b76b165 100644
--- a/chrome/browser/importer/importer_list.cc
+++ b/chrome/browser/importer/importer_list.cc
@@ -136,15 +136,10 @@ void ImporterList::DetectSourceProfilesHack() {
DetectSourceProfilesWorker();
}
-int ImporterList::GetAvailableProfileCount() const {
- DCHECK(source_profiles_loaded_);
- return static_cast<int>(source_profiles_.size());
-}
-
const importer::SourceProfile& ImporterList::GetSourceProfileAt(
- int index) const {
+ size_t index) const {
DCHECK(source_profiles_loaded_);
- DCHECK(index >= 0 && index < GetAvailableProfileCount());
+ DCHECK(index < count());
return *source_profiles_[index];
}
@@ -152,8 +147,7 @@ const importer::SourceProfile& ImporterList::GetSourceProfileForImporterType(
int importer_type) const {
DCHECK(source_profiles_loaded_);
- int count = GetAvailableProfileCount();
- for (int i = 0; i < count; ++i) {
+ for (size_t i = 0; i < count(); ++i) {
if (source_profiles_[i]->importer_type == importer_type)
return *source_profiles_[i];
}
@@ -161,10 +155,6 @@ const importer::SourceProfile& ImporterList::GetSourceProfileForImporterType(
return *(new importer::SourceProfile());
}
-bool ImporterList::source_profiles_loaded() const {
- return source_profiles_loaded_;
-}
-
void ImporterList::DetectSourceProfilesWorker() {
// TODO(jhawkins): Remove this condition once DetectSourceProfilesHack is
// removed.
diff --git a/chrome/browser/importer/importer_list.h b/chrome/browser/importer/importer_list.h
index 4ce5330..c1b61fd 100644
--- a/chrome/browser/importer/importer_list.h
+++ b/chrome/browser/importer/importer_list.h
@@ -49,20 +49,17 @@ class ImporterList : public base::RefCountedThreadSafe<ImporterList> {
void DetectSourceProfilesHack();
// Returns the number of different source profiles you can import from.
- int GetAvailableProfileCount() const;
+ size_t count() const { return source_profiles_.size(); }
// Returns the SourceProfile at |index|. The profiles are ordered such that
// the profile at index 0 is the likely default browser. The SourceProfile
// should be passed to ImporterHost::StartImportSettings().
- const importer::SourceProfile& GetSourceProfileAt(int index) const;
+ const importer::SourceProfile& GetSourceProfileAt(size_t index) const;
// Returns the SourceProfile for the given |importer_type|.
const importer::SourceProfile& GetSourceProfileForImporterType(
int importer_type) const;
- // Returns true if the source profiles have been loaded.
- bool source_profiles_loaded() const;
-
private:
friend class base::RefCountedThreadSafe<ImporterList>;
diff --git a/chrome/browser/ui/webui/options/import_data_handler.cc b/chrome/browser/ui/webui/options/import_data_handler.cc
index 4aee83f..29afaa6 100644
--- a/chrome/browser/ui/webui/options/import_data_handler.cc
+++ b/chrome/browser/ui/webui/options/import_data_handler.cc
@@ -120,8 +120,7 @@ void ImportDataHandler::ImportData(const ListValue* args) {
void ImportDataHandler::SourceProfilesLoaded() {
ListValue browser_profiles;
- int profiles_count = importer_list_->GetAvailableProfileCount();
- for (int i = 0; i < profiles_count; i++) {
+ for (size_t i = 0; i < importer_list_->count(); ++i) {
const importer::SourceProfile& source_profile =
importer_list_->GetSourceProfileAt(i);
uint16 browser_services = source_profile.services_supported;