summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/SConscript.unit_tests9
-rw-r--r--chrome/browser/SConscript27
-rw-r--r--chrome/browser/autocomplete/autocomplete_popup.cc1
-rw-r--r--chrome/browser/bookmark_bar_context_menu_controller.cc1
-rw-r--r--chrome/browser/bookmarks/bookmark_codec.cc1
-rw-r--r--chrome/browser/bookmarks/bookmark_model.cc1
-rw-r--r--chrome/browser/download/save_file.cc31
-rw-r--r--chrome/browser/download/save_file.h4
-rw-r--r--chrome/browser/download/save_types.h4
-rw-r--r--chrome/browser/encoding_menu_controller_delegate.cc1
-rw-r--r--chrome/browser/history/history_types.h4
-rw-r--r--chrome/browser/history/history_types_unittest.cc24
-rw-r--r--chrome/browser/history/in_memory_history_backend.cc1
-rw-r--r--chrome/browser/history/snippet.h1
-rw-r--r--chrome/browser/history/text_database.cc16
-rw-r--r--chrome/browser/history/text_database_manager.cc4
-rw-r--r--chrome/browser/history/text_database_unittest.cc14
-rw-r--r--chrome/browser/history/thumbnail_database.h3
-rw-r--r--chrome/browser/history/url_database.h2
-rw-r--r--chrome/browser/history/visit_tracker.cc4
-rw-r--r--chrome/browser/history/visitsegment_database.cc2
-rw-r--r--chrome/browser/history_view.cc1
-rw-r--r--chrome/browser/profile_manager.h1
-rw-r--r--chrome/browser/safe_browsing/bloom_filter_unittest.cc9
-rw-r--r--chrome/browser/tab_contents.cc1
-rw-r--r--chrome/browser/template_url.cc8
-rw-r--r--chrome/browser/template_url.h8
-rw-r--r--chrome/browser/template_url_model.cc1
-rw-r--r--chrome/browser/views/download_item_view.cc1
-rw-r--r--chrome/browser/views/tabs/tab.cc1
-rw-r--r--chrome/browser/views/tabs/tab_renderer.cc1
-rw-r--r--chrome/browser/web_contents.cc1
-rw-r--r--chrome/common/mru_cache.h26
33 files changed, 122 insertions, 92 deletions
diff --git a/chrome/SConscript.unit_tests b/chrome/SConscript.unit_tests
index 60110fe..30ee76a 100644
--- a/chrome/SConscript.unit_tests
+++ b/chrome/SConscript.unit_tests
@@ -128,11 +128,15 @@ if env_test['PLATFORM'] in ('posix', 'win32'):
# TODO(port): Port to Mac.
unit_test_files.extend([
'browser/chrome_thread_unittest.cc',
+ 'browser/history/history_types_unittest.cc',
+ 'browser/history/text_database_unittest.cc',
+ 'browser/history/visit_tracker_unittest.cc',
'browser/metrics_response_unittest.cc',
'browser/net/dns_host_info_unittest.cc',
'browser/printing/page_range_unittest.cc',
'browser/printing/page_setup_unittest.cc',
'browser/printing/units_unittest.cc',
+ 'browser/safe_browsing/bloom_filter_unittest.cc',
'browser/safe_browsing/chunk_range_unittest.cc',
'browser/safe_browsing/protocol_parser_unittest.cc',
'browser/safe_browsing/safe_browsing_util_unittest.cc',
@@ -147,6 +151,7 @@ if env_test['PLATFORM'] in ('posix', 'win32'):
LIBS = [
'browser',
'common',
+ 'sqlite',
],
)
@@ -170,17 +175,14 @@ if env_test['PLATFORM'] == 'win32':
'browser/history/expire_history_backend_unittest.cc',
'browser/history/history_backend_unittest.cc',
'browser/history/history_querying_unittest.cc',
- 'browser/history/history_types_unittest.cc',
'browser/history/history_unittest.cc',
'browser/history/query_parser_unittest.cc',
'browser/history/snippet_unittest.cc',
'browser/history/starred_url_database_unittest.cc',
'browser/history/text_database_manager_unittest.cc',
- 'browser/history/text_database_unittest.cc',
'browser/history/thumbnail_database_unittest.cc',
'browser/history/url_database_unittest.cc',
'browser/history/visit_database_unittest.cc',
- 'browser/history/visit_tracker_unittest.cc',
'browser/importer/firefox_importer_unittest.cc',
'browser/importer/importer_unittest.cc',
'browser/metrics_log_unittest.cc',
@@ -194,7 +196,6 @@ if env_test['PLATFORM'] == 'win32':
'browser/renderer_security_policy_unittest.cc',
'browser/resource_dispatcher_host_unittest.cc',
'browser/rlz/rlz_unittest.cc',
- 'browser/safe_browsing/bloom_filter_unittest.cc',
'browser/safe_browsing/protocol_manager_unittest.cc',
'browser/safe_browsing/safe_browsing_database_unittest.cc',
'browser/safe_browsing/safe_browsing_database_impl_unittest.cc',
diff --git a/chrome/browser/SConscript b/chrome/browser/SConscript
index 3c1a499..f6709c0 100644
--- a/chrome/browser/SConscript
+++ b/chrome/browser/SConscript
@@ -64,8 +64,21 @@ if env['PLATFORM'] in ('posix', 'win32'):
'cancelable_request.cc',
'chrome_thread.cc',
'cross_site_request_manager.cc',
+ 'download/save_file.cc',
'google_url_tracker.cc',
'google_util.cc',
+ 'history/archived_database.cc',
+ 'history/history_types.cc',
+ 'history/in_memory_database.cc',
+ 'history/in_memory_history_backend.cc',
+ 'history/page_usage_data.cc',
+ 'history/snippet.cc',
+ 'history/text_database.cc',
+ 'history/text_database_manager.cc',
+ 'history/thumbnail_database.cc',
+ 'history/visit_database.cc',
+ 'history/visit_tracker.cc',
+ 'history/visitsegment_database.cc',
'meta_table_helper.cc',
'metrics_response.cc',
'net/dns_host_info.cc',
@@ -78,6 +91,8 @@ if env['PLATFORM'] in ('posix', 'win32'):
'safe_browsing/bloom_filter.cc',
'safe_browsing/chunk_range.cc',
'safe_browsing/protocol_parser.cc',
+ 'safe_browsing/safe_browsing_database.cc',
+ 'safe_browsing/safe_browsing_service.cc',
'safe_browsing/safe_browsing_util.cc',
'session_startup_pref.cc',
'url_fetcher_protect.cc',
@@ -161,26 +176,14 @@ if env['PLATFORM'] == 'win32':
'gears_integration.cc',
'hang_monitor/hung_plugin_action.cc',
'hang_monitor/hung_window_detector.cc',
- 'history/archived_database.cc',
'history/download_database.cc',
'history/expire_history_backend.cc',
'history/history.cc',
'history/history_backend.cc',
'history/history_database.cc',
- 'history/history_types.cc',
- 'history/in_memory_database.cc',
- 'history/in_memory_history_backend.cc',
- 'history/page_usage_data.cc',
'history/query_parser.cc',
- 'history/snippet.cc',
'history/starred_url_database.cc',
- 'history/text_database.cc',
- 'history/text_database_manager.cc',
- 'history/thumbnail_database.cc',
'history/url_database.cc',
- 'history/visit_database.cc',
- 'history/visit_tracker.cc',
- 'history/visitsegment_database.cc',
'history_model.cc',
'history_tab_ui.cc',
'history_view.cc',
diff --git a/chrome/browser/autocomplete/autocomplete_popup.cc b/chrome/browser/autocomplete/autocomplete_popup.cc
index 9886339..c04f50d 100644
--- a/chrome/browser/autocomplete/autocomplete_popup.cc
+++ b/chrome/browser/autocomplete/autocomplete_popup.cc
@@ -17,6 +17,7 @@
#include "chrome/browser/template_url_model.h"
#include "chrome/browser/views/location_bar_view.h"
#include "chrome/common/gfx/chrome_canvas.h"
+#include "chrome/common/l10n_util.h"
#include "chrome/common/resource_bundle.h"
#include "third_party/icu38/public/common/unicode/ubidi.h"
diff --git a/chrome/browser/bookmark_bar_context_menu_controller.cc b/chrome/browser/bookmark_bar_context_menu_controller.cc
index 9878df3..d7c1010d 100644
--- a/chrome/browser/bookmark_bar_context_menu_controller.cc
+++ b/chrome/browser/bookmark_bar_context_menu_controller.cc
@@ -13,6 +13,7 @@
#include "chrome/browser/user_metrics.h"
#include "chrome/browser/views/bookmark_editor_view.h"
#include "chrome/browser/views/input_window.h"
+#include "chrome/common/l10n_util.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/pref_service.h"
#include "chrome/views/view_container.h"
diff --git a/chrome/browser/bookmarks/bookmark_codec.cc b/chrome/browser/bookmarks/bookmark_codec.cc
index 04acf49..d37f830 100644
--- a/chrome/browser/bookmarks/bookmark_codec.cc
+++ b/chrome/browser/bookmarks/bookmark_codec.cc
@@ -7,6 +7,7 @@
#include "base/string_util.h"
#include "base/values.h"
#include "chrome/browser/bookmarks/bookmark_model.h"
+#include "chrome/common/l10n_util.h"
#include "googleurl/src/gurl.h"
#include "generated_resources.h"
diff --git a/chrome/browser/bookmarks/bookmark_model.cc b/chrome/browser/bookmarks/bookmark_model.cc
index 0b7a212..5e29095 100644
--- a/chrome/browser/bookmarks/bookmark_model.cc
+++ b/chrome/browser/bookmarks/bookmark_model.cc
@@ -8,6 +8,7 @@
#include "chrome/browser/bookmarks/bookmark_storage.h"
#include "chrome/browser/history/query_parser.h"
#include "chrome/browser/profile.h"
+#include "chrome/common/l10n_util.h"
#include "chrome/common/scoped_vector.h"
#include "generated_resources.h"
diff --git a/chrome/browser/download/save_file.cc b/chrome/browser/download/save_file.cc
index b92edf2..cc6315c 100644
--- a/chrome/browser/download/save_file.cc
+++ b/chrome/browser/download/save_file.cc
@@ -4,12 +4,16 @@
#include "chrome/browser/download/save_file.h"
+#include "base/basictypes.h"
#include "base/file_util.h"
#include "base/logging.h"
#include "base/path_service.h"
+#include "base/string_util.h"
#include "chrome/browser/download/save_types.h"
+#if defined(OS_WIN)
#include "chrome/common/win_util.h"
#include "chrome/common/win_safe_util.h"
+#endif
SaveFile::SaveFile(const SaveFileCreateInfo* info)
: info_(info),
@@ -20,7 +24,7 @@ SaveFile::SaveFile(const SaveFileCreateInfo* info)
DCHECK(info);
DCHECK(info->path.empty());
if (file_util::CreateTemporaryFileName(&full_path_))
- Open(L"wb");
+ Open("wb");
}
SaveFile::~SaveFile() {
@@ -30,7 +34,7 @@ SaveFile::~SaveFile() {
// Return false indicate that we got disk error, save file manager will tell
// SavePackage this error, then SavePackage will call its Cancel() method to
// cancel whole save job.
-bool SaveFile::AppendDataToFile(const char* data, int data_len) {
+bool SaveFile::AppendDataToFile(const char* data, size_t data_len) {
if (file_) {
if (data_len == fwrite(data, 1, data_len, file_)) {
bytes_so_far_ += data_len;
@@ -49,7 +53,7 @@ void SaveFile::Cancel() {
// If this job has been canceled, and it has created file,
// We need to delete this created file.
if (!full_path_.empty()) {
- DeleteFile(full_path_.c_str());
+ file_util::Delete(full_path_, false);
}
}
@@ -60,19 +64,17 @@ bool SaveFile::Rename(const std::wstring& new_path) {
DCHECK(!path_renamed());
// We cannot rename because rename will keep the same security descriptor
// on the destination file. We want to recreate the security descriptor
- // with the security that makes sense in the new path. If the last parameter
- // is FALSE and the new file already exists, the function overwrites the
- // existing file and succeeds.
- if (!CopyFile(full_path_.c_str(), new_path.c_str(), FALSE))
+ // with the security that makes sense in the new path.
+ if (!file_util::CopyFile(full_path_, new_path))
return false;
- DeleteFile(full_path_.c_str());
+ file_util::Delete(full_path_, false);
full_path_ = new_path;
path_renamed_ = true;
// Still in saving process, reopen the file.
- if (in_progress_ && !Open(L"a+b"))
+ if (in_progress_ && !Open("a+b"))
return false;
return true;
}
@@ -84,20 +86,23 @@ void SaveFile::Finish() {
void SaveFile::Close() {
if (file_) {
- fclose(file_);
+ file_util::CloseFile(file_);
file_ = NULL;
}
}
-bool SaveFile::Open(const wchar_t* open_mode) {
+bool SaveFile::Open(const char* open_mode) {
DCHECK(!full_path_.empty());
- if (_wfopen_s(&file_, full_path_.c_str(), open_mode)) {
- file_ = NULL;
+ file_ = file_util::OpenFile(full_path_, open_mode);
+ if (!file_) {
return false;
}
+#if defined(OS_WIN)
// Sets the zone to tell Windows that this file comes from the Internet.
// We ignore the return value because a failure is not fatal.
+ // TODO(port): Similarly mark on Mac.
win_util::SetInternetZoneIdentifier(full_path_);
+#endif
return true;
}
diff --git a/chrome/browser/download/save_file.h b/chrome/browser/download/save_file.h
index 3d5e06c..361e20c 100644
--- a/chrome/browser/download/save_file.h
+++ b/chrome/browser/download/save_file.h
@@ -24,7 +24,7 @@ class SaveFile {
~SaveFile();
// Write a new chunk of data to the file. Returns true on success.
- bool AppendDataToFile(const char* data, int data_len);
+ bool AppendDataToFile(const char* data, size_t data_len);
// Abort the saving job and automatically close the file.
void Cancel();
@@ -53,7 +53,7 @@ class SaveFile {
// based on creation information passed to it, and automatically closed in
// the destructor.
void Close();
- bool Open(const wchar_t* open_mode);
+ bool Open(const char* open_mode);
scoped_ptr<const SaveFileCreateInfo> info_;
diff --git a/chrome/browser/download/save_types.h b/chrome/browser/download/save_types.h
index 1a8832c..624aaa6 100644
--- a/chrome/browser/download/save_types.h
+++ b/chrome/browser/download/save_types.h
@@ -35,11 +35,11 @@ struct SaveFileCreateInfo {
: path(path),
url(url),
save_id(save_id),
- save_source(save_source),
render_process_id(-1),
render_view_id(-1),
request_id(-1),
- total_bytes(0) {
+ total_bytes(0),
+ save_source(save_source) {
}
SaveFileCreateInfo() : save_id(-1) {}
diff --git a/chrome/browser/encoding_menu_controller_delegate.cc b/chrome/browser/encoding_menu_controller_delegate.cc
index f5fd29a..0d5ecb1 100644
--- a/chrome/browser/encoding_menu_controller_delegate.cc
+++ b/chrome/browser/encoding_menu_controller_delegate.cc
@@ -10,6 +10,7 @@
#include "chrome/browser/character_encoding.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/tab_contents.h"
+#include "chrome/common/l10n_util.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/pref_service.h"
diff --git a/chrome/browser/history/history_types.h b/chrome/browser/history/history_types.h
index 9224c2a..5ad53205 100644
--- a/chrome/browser/history/history_types.h
+++ b/chrome/browser/history/history_types.h
@@ -125,8 +125,8 @@ class URLRow {
private:
// This class writes directly into this structure and clears our dirty bits
// when reading out of the DB.
- friend URLDatabase;
- friend HistoryBackend;
+ friend class URLDatabase;
+ friend class HistoryBackend;
// Initializes all values that need initialization to their defaults.
// This excludes objects which autoinitialize such as strings.
diff --git a/chrome/browser/history/history_types_unittest.cc b/chrome/browser/history/history_types_unittest.cc
index 2fbfd36..7365e53 100644
--- a/chrome/browser/history/history_types_unittest.cc
+++ b/chrome/browser/history/history_types_unittest.cc
@@ -75,13 +75,13 @@ TEST(HistoryQueryResult, DeleteRange) {
// order.
size_t match_count;
const size_t* matches = results.MatchesForURL(url1, &match_count);
- ASSERT_EQ(2, match_count);
+ ASSERT_EQ(2U, match_count);
EXPECT_TRUE((matches[0] == 0 && matches[1] == 1) ||
(matches[0] == 1 && matches[1] == 0));
// Check the second one.
matches = results.MatchesForURL(url2, &match_count);
- ASSERT_EQ(1, match_count);
+ ASSERT_EQ(1U, match_count);
EXPECT_TRUE(matches[0] == 2);
// Delete the first instance of the first URL.
@@ -90,15 +90,15 @@ TEST(HistoryQueryResult, DeleteRange) {
// Check the two URLs.
matches = results.MatchesForURL(url1, &match_count);
- ASSERT_EQ(1, match_count);
+ ASSERT_EQ(1U, match_count);
EXPECT_TRUE(matches[0] == 0);
matches = results.MatchesForURL(url2, &match_count);
- ASSERT_EQ(1, match_count);
+ ASSERT_EQ(1U, match_count);
EXPECT_TRUE(matches[0] == 1);
// Now delete everything and make sure it's deleted.
results.DeleteRange(0, 1);
- EXPECT_EQ(0, results.size());
+ EXPECT_EQ(0U, results.size());
EXPECT_FALSE(results.MatchesForURL(url1, NULL));
EXPECT_FALSE(results.MatchesForURL(url2, NULL));
}
@@ -113,18 +113,18 @@ TEST(HistoryQueryResult, ResultDeleteURL) {
// Delete the first URL.
results.DeleteURL(url1);
CheckHistoryResultConsistency(results);
- EXPECT_EQ(1, results.size());
+ EXPECT_EQ(1U, results.size());
// The first one should be gone, and the second one should be at [0].
size_t match_count;
EXPECT_FALSE(results.MatchesForURL(url1, NULL));
const size_t* matches = results.MatchesForURL(url2, &match_count);
- ASSERT_EQ(1, match_count);
+ ASSERT_EQ(1U, match_count);
EXPECT_TRUE(matches[0] == 0);
// Delete the second URL, there should be nothing left.
results.DeleteURL(url2);
- EXPECT_EQ(0, results.size());
+ EXPECT_EQ(0U, results.size());
EXPECT_FALSE(results.MatchesForURL(url2, NULL));
}
@@ -146,23 +146,23 @@ TEST(HistoryQueryResult, AppendResults) {
// There should be 3 results, the second one of the appendee should be
// deleted because it was already in the first one and we said remove dupes.
- ASSERT_EQ(4, results.size());
+ ASSERT_EQ(4U, results.size());
// The first URL should be unchanged in the first two spots.
size_t match_count;
const size_t* matches = results.MatchesForURL(url1, &match_count);
- ASSERT_EQ(2, match_count);
+ ASSERT_EQ(2U, match_count);
EXPECT_TRUE((matches[0] == 0 && matches[1] == 1) ||
(matches[0] == 1 && matches[1] == 0));
// The second URL should be there once after that
matches = results.MatchesForURL(url2, &match_count);
- ASSERT_EQ(1, match_count);
+ ASSERT_EQ(1U, match_count);
EXPECT_TRUE(matches[0] == 2);
// The third one should be after that.
matches = results.MatchesForURL(url3, &match_count);
- ASSERT_EQ(1, match_count);
+ ASSERT_EQ(1U, match_count);
EXPECT_TRUE(matches[0] == 3);
}
diff --git a/chrome/browser/history/in_memory_history_backend.cc b/chrome/browser/history/in_memory_history_backend.cc
index 4868f68..5e942d6 100644
--- a/chrome/browser/history/in_memory_history_backend.cc
+++ b/chrome/browser/history/in_memory_history_backend.cc
@@ -5,7 +5,6 @@
#include "chrome/browser/history/in_memory_history_backend.h"
#include "chrome/browser/browser_process.h"
-#include "chrome/browser/history/history_database.h"
#include "chrome/browser/history/history_notifications.h"
#include "chrome/browser/history/in_memory_database.h"
#include "chrome/browser/profile.h"
diff --git a/chrome/browser/history/snippet.h b/chrome/browser/history/snippet.h
index fb17a22..b741c6c 100644
--- a/chrome/browser/history/snippet.h
+++ b/chrome/browser/history/snippet.h
@@ -8,6 +8,7 @@
#ifndef CHROME_BROWSER_HISTORY_SNIPPET_H__
#define CHROME_BROWSER_HISTORY_SNIPPET_H__
+#include <string>
#include <vector>
class Snippet {
diff --git a/chrome/browser/history/text_database.cc b/chrome/browser/history/text_database.cc
index 414b133..46fd8c0 100644
--- a/chrome/browser/history/text_database.cc
+++ b/chrome/browser/history/text_database.cc
@@ -115,15 +115,17 @@ TextDatabase::DBIdent TextDatabase::FileNameToID(const std::wstring& file_path){
// We don't actually check the prefix here. Since the file system could
// be case insensitive in ways we can't predict (NTFS), checking could
// potentially be the wrong thing to do. Instead, we just look for a suffix.
- static const int kIDStringLength = 7; // Room for "xxxx-xx".
+ static const size_t kIDStringLength = 7; // Room for "xxxx-xx".
if (file_name.length() < kIDStringLength)
return 0;
- const wchar_t* number_begin =
- &file_name[file_name.length() - kIDStringLength];
+ const std::wstring suffix(&file_name[file_name.length() - kIDStringLength]);
- int year, month;
- if (swscanf_s(number_begin, L"%d-%d", &year, &month) != 2)
- return 0; // Unable to get both numbers.
+ if (suffix.length() != kIDStringLength || suffix[4] != L'-') {
+ return 0;
+ }
+
+ int year = StringToInt(suffix.substr(0, 4));
+ int month = StringToInt(suffix.substr(5, 2));
return year * 100 + month;
}
@@ -348,7 +350,7 @@ void TextDatabase::GetTextMatches(const std::string& query,
Match& match = results->at(results->size() - 1);
match.url.Swap(&url);
- match.title = statement->column_string16(1);
+ match.title = UTF8ToWide(statement->column_string(1));
match.time = Time::FromInternalValue(statement->column_int64(2));
// Extract any matches in the title.
diff --git a/chrome/browser/history/text_database_manager.cc b/chrome/browser/history/text_database_manager.cc
index 9bb1ba7..e96aa5b 100644
--- a/chrome/browser/history/text_database_manager.cc
+++ b/chrome/browser/history/text_database_manager.cc
@@ -4,6 +4,7 @@
#include "chrome/browser/history/text_database_manager.h"
+#include "base/compiler_specific.h"
#include "base/file_util.h"
#include "base/histogram.h"
#include "base/logging.h"
@@ -70,8 +71,7 @@ TextDatabaseManager::TextDatabaseManager(const std::wstring& dir,
transaction_nesting_(0),
db_cache_(DBCache::NO_AUTO_EVICT),
present_databases_loaded_(false),
-#pragma warning(suppress: 4355) // Okay to pass "this" here.
- factory_(this) {
+ ALLOW_THIS_IN_INITIALIZER_LIST(factory_(this)) {
}
TextDatabaseManager::~TextDatabaseManager() {
diff --git a/chrome/browser/history/text_database_unittest.cc b/chrome/browser/history/text_database_unittest.cc
index c041012..b16abe0 100644
--- a/chrome/browser/history/text_database_unittest.cc
+++ b/chrome/browser/history/text_database_unittest.cc
@@ -202,7 +202,7 @@ TEST_F(TextDatabaseTest, Query) {
EXPECT_TRUE(unique_urls.empty()) << "Didn't ask for unique URLs";
// All 3 sites should be returned in order.
- ASSERT_EQ(3, results.size());
+ ASSERT_EQ(3U, results.size());
EXPECT_EQ(GURL(kURL1), results[2].url);
EXPECT_EQ(GURL(kURL2), results[1].url);
EXPECT_EQ(GURL(kURL3), results[0].url);
@@ -217,9 +217,9 @@ TEST_F(TextDatabaseTest, Query) {
EXPECT_EQ(UTF8ToWide(std::string(kTitle3)), results[0].title);
// Should have no matches in the title.
- EXPECT_EQ(0, results[0].title_match_positions.size());
- EXPECT_EQ(0, results[1].title_match_positions.size());
- EXPECT_EQ(0, results[2].title_match_positions.size());
+ EXPECT_EQ(0U, results[0].title_match_positions.size());
+ EXPECT_EQ(0U, results[1].title_match_positions.size());
+ EXPECT_EQ(0U, results[2].title_match_positions.size());
// We don't want to be dependent on the exact snippet algorithm, but we know
// since we searched for "COUNTTAG" which occurs at the beginning of each
@@ -253,7 +253,7 @@ TEST_F(TextDatabaseTest, TimeRange) {
EXPECT_TRUE(unique_urls.empty()) << "Didn't ask for unique URLs";
// The first and second should have been returned.
- EXPECT_EQ(2, results.size());
+ EXPECT_EQ(2U, results.size());
EXPECT_TRUE(ResultsHaveURL(results, kURL1));
EXPECT_TRUE(ResultsHaveURL(results, kURL2));
EXPECT_FALSE(ResultsHaveURL(results, kURL3));
@@ -273,7 +273,7 @@ TEST_F(TextDatabaseTest, TimeRange) {
first_time_searched.ToInternalValue());
// Should have two results, the second and third.
- EXPECT_EQ(2, results.size());
+ EXPECT_EQ(2U, results.size());
EXPECT_FALSE(ResultsHaveURL(results, kURL1));
EXPECT_TRUE(ResultsHaveURL(results, kURL2));
EXPECT_TRUE(ResultsHaveURL(results, kURL3));
@@ -311,7 +311,7 @@ TEST_F(TextDatabaseTest, MaxCount) {
EXPECT_TRUE(unique_urls.empty()) << "Didn't ask for unique URLs";
// There should be one result, the most recent one.
- EXPECT_EQ(1, results.size());
+ EXPECT_EQ(1U, results.size());
EXPECT_TRUE(ResultsHaveURL(results, kURL2));
// The max time considered should be the date of the returned item.
diff --git a/chrome/browser/history/thumbnail_database.h b/chrome/browser/history/thumbnail_database.h
index 15a81ee..f98d8e9 100644
--- a/chrome/browser/history/thumbnail_database.h
+++ b/chrome/browser/history/thumbnail_database.h
@@ -7,10 +7,11 @@
#include <vector>
-#include "chrome/browser/history/history_database.h"
#include "chrome/browser/history/history_types.h"
#include "chrome/browser/history/url_database.h" // For DBCloseScoper.
+#include "chrome/browser/meta_table_helper.h"
#include "chrome/common/sqlite_compiled_statement.h"
+#include "skia/include/SkBitmap.h"
struct sqlite3;
struct ThumbnailScore;
diff --git a/chrome/browser/history/url_database.h b/chrome/browser/history/url_database.h
index 4dfcdcc..745c7e3 100644
--- a/chrome/browser/history/url_database.h
+++ b/chrome/browser/history/url_database.h
@@ -230,7 +230,7 @@ class URLDatabase {
bool MigrateFromVersion11ToVersion12();
protected:
- friend VisitDatabase;
+ friend class VisitDatabase;
// See HISTORY_URL_ROW_FIELDS below.
static const char kURLRowFields[];
diff --git a/chrome/browser/history/visit_tracker.cc b/chrome/browser/history/visit_tracker.cc
index dd32d54..26bcaf8 100644
--- a/chrome/browser/history/visit_tracker.cc
+++ b/chrome/browser/history/visit_tracker.cc
@@ -11,8 +11,8 @@ namespace history {
// When the list gets longer than 'MaxItems', CleanupTransitionList will resize
// the list down to 'ResizeTo' size. This is so we only do few block moves of
// the data rather than constantly shuffle stuff around in the vector.
-static const int kMaxItemsInTransitionList = 96;
-static const int kResizeBigTransitionListTo = 64;
+static const size_t kMaxItemsInTransitionList = 96;
+static const size_t kResizeBigTransitionListTo = 64;
COMPILE_ASSERT(kResizeBigTransitionListTo < kMaxItemsInTransitionList,
max_items_must_be_larger_than_resize_to);
diff --git a/chrome/browser/history/visitsegment_database.cc b/chrome/browser/history/visitsegment_database.cc
index 2e07df6..8754018 100644
--- a/chrome/browser/history/visitsegment_database.cc
+++ b/chrome/browser/history/visitsegment_database.cc
@@ -240,7 +240,7 @@ void VisitSegmentDatabase::QuerySegmentUsage(
// does as well.
// How many results we return, as promised in the header file.
- const int kResultCount = 9;
+ const size_t kResultCount = 9;
// Gather all the segment scores:
SQLITE_UNIQUE_STATEMENT(statement, GetStatementCache(),
diff --git a/chrome/browser/history_view.cc b/chrome/browser/history_view.cc
index 340280a..737eedf 100644
--- a/chrome/browser/history_view.cc
+++ b/chrome/browser/history_view.cc
@@ -18,6 +18,7 @@
#include "chrome/common/drag_drop_types.h"
#include "chrome/common/gfx/chrome_canvas.h"
#include "chrome/common/gfx/favicon_size.h"
+#include "chrome/common/l10n_util.h"
#include "chrome/common/resource_bundle.h"
#include "chrome/common/time_format.h"
#include "chrome/common/win_util.h"
diff --git a/chrome/browser/profile_manager.h b/chrome/browser/profile_manager.h
index 9f1c1ea..92ee707 100644
--- a/chrome/browser/profile_manager.h
+++ b/chrome/browser/profile_manager.h
@@ -153,7 +153,6 @@ class ProfileManager {
// We keep a simple vector of profiles rather than something fancier
// because we expect there to be a small number of profiles active.
- typedef std::vector<Profile*> ProfileVector;
ProfileVector profiles_;
AvailableProfileVector available_profiles_;
diff --git a/chrome/browser/safe_browsing/bloom_filter_unittest.cc b/chrome/browser/safe_browsing/bloom_filter_unittest.cc
index bbbf8e4..edfefa9 100644
--- a/chrome/browser/safe_browsing/bloom_filter_unittest.cc
+++ b/chrome/browser/safe_browsing/bloom_filter_unittest.cc
@@ -12,7 +12,6 @@
#include "base/logging.h"
#include "base/rand_util.h"
#include "base/string_util.h"
-#include "base/win_util.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace {
@@ -24,19 +23,15 @@ uint32 GenHash() {
}
TEST(SafeBrowsing, BloomFilter) {
- // rand_util isn't random enough on Win2K, see bug 1076619.
- if (win_util::GetWinVersion() == win_util::WINVERSION_2000)
- return;
-
// Use a small number for unit test so it's not slow.
- int count = 1000;//100000;
+ uint32 count = 1000;
// Build up the bloom filter.
BloomFilter filter(count * 10);
typedef std::set<int> Values;
Values values;
- for (int i = 0; i < count; ++i) {
+ for (uint32 i = 0; i < count; ++i) {
uint32 value = GenHash();
values.insert(value);
filter.Insert(value);
diff --git a/chrome/browser/tab_contents.cc b/chrome/browser/tab_contents.cc
index 2a2a03c..4fa4dfe 100644
--- a/chrome/browser/tab_contents.cc
+++ b/chrome/browser/tab_contents.cc
@@ -10,6 +10,7 @@
#include "chrome/browser/views/download_started_animation.h"
#include "chrome/browser/web_contents.h"
#include "chrome/browser/tab_contents_delegate.h"
+#include "chrome/common/l10n_util.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/pref_service.h"
#include "chrome/views/native_scroll_bar.h"
diff --git a/chrome/browser/template_url.cc b/chrome/browser/template_url.cc
index 8a04218..c214db8 100644
--- a/chrome/browser/template_url.cc
+++ b/chrome/browser/template_url.cc
@@ -11,6 +11,7 @@
#include "chrome/browser/google_url_tracker.h"
#include "chrome/browser/template_url_model.h"
#include "chrome/common/gfx/favicon_size.h"
+#include "chrome/common/l10n_util.h"
#include "net/base/escape.h"
// The TemplateURLRef has any number of terms that need to be replaced. Each of
@@ -503,6 +504,13 @@ void TemplateURL::SetURL(const std::wstring& url,
url_.Set(url, index_offset, page_offset);
}
+void TemplateURL::set_keyword(const std::wstring& keyword) {
+ // Case sensitive keyword matching is confusing. As such, we force all
+ // keywords to be lower case.
+ keyword_ = l10n_util::ToLower(keyword);
+ autogenerate_keyword_ = false;
+}
+
const std::wstring& TemplateURL::keyword() const {
if (autogenerate_keyword_ && keyword_.empty()) {
// Generate a keyword and cache it.
diff --git a/chrome/browser/template_url.h b/chrome/browser/template_url.h
index a1168ca..bbb752e 100644
--- a/chrome/browser/template_url.h
+++ b/chrome/browser/template_url.h
@@ -9,7 +9,6 @@
#include "base/basictypes.h"
#include "base/time.h"
-#include "chrome/common/l10n_util.h"
#include "googleurl/src/gurl.h"
class TemplateURL;
@@ -307,12 +306,7 @@ class TemplateURL {
const GURL& originating_url() const { return originating_url_; }
// The shortcut for this template url. May be empty.
- void set_keyword(const std::wstring& keyword) {
- // Case sensitive keyword matching is confusing. As such, we force all
- // keywords to be lower case.
- keyword_ = l10n_util::ToLower(keyword);
- autogenerate_keyword_ = false;
- }
+ void set_keyword(const std::wstring& keyword);
const std::wstring& keyword() const;
// Whether to autogenerate a keyword from the url() in GetKeyword(). Most
diff --git a/chrome/browser/template_url_model.cc b/chrome/browser/template_url_model.cc
index b10d08d..c93da96 100644
--- a/chrome/browser/template_url_model.cc
+++ b/chrome/browser/template_url_model.cc
@@ -16,6 +16,7 @@
#include "chrome/browser/rlz/rlz.h"
#include "chrome/browser/template_url.h"
#include "chrome/browser/template_url_prepopulate_data.h"
+#include "chrome/common/l10n_util.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/pref_service.h"
#include "chrome/common/stl_util-inl.h"
diff --git a/chrome/browser/views/download_item_view.cc b/chrome/browser/views/download_item_view.cc
index a03b5bc..2dcba5a 100644
--- a/chrome/browser/views/download_item_view.cc
+++ b/chrome/browser/views/download_item_view.cc
@@ -11,6 +11,7 @@
#include "chrome/browser/download/download_util.h"
#include "chrome/browser/views/download_shelf_view.h"
#include "chrome/common/gfx/chrome_canvas.h"
+#include "chrome/common/l10n_util.h"
#include "chrome/common/resource_bundle.h"
#include "chrome/common/win_util.h"
#include "chrome/views/root_view.h"
diff --git a/chrome/browser/views/tabs/tab.cc b/chrome/browser/views/tabs/tab.cc
index 8a283bf..8a6f205 100644
--- a/chrome/browser/views/tabs/tab.cc
+++ b/chrome/browser/views/tabs/tab.cc
@@ -8,6 +8,7 @@
#include "chrome/views/view_container.h"
#include "chrome/common/gfx/chrome_canvas.h"
#include "chrome/common/gfx/path.h"
+#include "chrome/common/l10n_util.h"
#include "chrome/common/resource_bundle.h"
#include "chrome/views/chrome_menu.h"
#include "chrome/views/tooltip_manager.h"
diff --git a/chrome/browser/views/tabs/tab_renderer.cc b/chrome/browser/views/tabs/tab_renderer.cc
index e4505a3..44cd363 100644
--- a/chrome/browser/views/tabs/tab_renderer.cc
+++ b/chrome/browser/views/tabs/tab_renderer.cc
@@ -13,6 +13,7 @@
#include "chrome/browser/tab_contents.h"
#include "chrome/common/gfx/chrome_canvas.h"
#include "chrome/common/gfx/chrome_font.h"
+#include "chrome/common/l10n_util.h"
#include "chrome/common/resource_bundle.h"
#include "chrome/common/win_util.h"
#include "generated_resources.h"
diff --git a/chrome/browser/web_contents.cc b/chrome/browser/web_contents.cc
index c31f256..d8eb687 100644
--- a/chrome/browser/web_contents.cc
+++ b/chrome/browser/web_contents.cc
@@ -40,6 +40,7 @@
#include "chrome/browser/web_drop_target.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/gfx/chrome_canvas.h"
+#include "chrome/common/l10n_util.h"
#include "chrome/common/os_exchange_data.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/pref_service.h"
diff --git a/chrome/common/mru_cache.h b/chrome/common/mru_cache.h
index 615f614..d3478b1 100644
--- a/chrome/common/mru_cache.h
+++ b/chrome/common/mru_cache.h
@@ -70,7 +70,7 @@ class MRUCacheBase {
// will take ownership of the pointer.
iterator Put(const KeyType& key, const PayloadType& payload) {
// Remove any existing payload with that key.
- KeyIndex::iterator index_iter = index_.find(key);
+ typename KeyIndex::iterator index_iter = index_.find(key);
if (index_iter != index_.end()) {
// Erase the reference to it. This will call the deletor on the removed
// element. The index reference will be replaced in the code below.
@@ -92,10 +92,10 @@ class MRUCacheBase {
//
// TODO(brettw) We may want a const version of this function in the future.
iterator Get(const KeyType& key) {
- KeyIndex::iterator index_iter = index_.find(key);
+ typename KeyIndex::iterator index_iter = index_.find(key);
if (index_iter == index_.end())
return end();
- PayloadList::iterator iter = index_iter->second;
+ typename PayloadList::iterator iter = index_iter->second;
// Move the touched item to the front of the recency ordering.
ordering_.splice(ordering_.begin(), ordering_, iter);
@@ -107,7 +107,7 @@ class MRUCacheBase {
//
// TODO(brettw) We may want a const version of this function in the future.
iterator Peek(const KeyType& key) {
- KeyIndex::const_iterator index_iter = index_.find(key);
+ typename KeyIndex::const_iterator index_iter = index_.find(key);
if (index_iter == index_.end())
return end();
return index_iter->second;
@@ -190,15 +190,20 @@ template <class KeyType, class PayloadType>
class MRUCache : public MRUCacheBase<KeyType,
PayloadType,
MRUCacheNullDeletor<PayloadType> > {
+ private:
+ typedef MRUCacheBase<KeyType, PayloadType,
+ MRUCacheNullDeletor<PayloadType> > ParentType;
+
public:
// See MRUCacheBase, noting the possibility of using NO_AUTO_EVICT.
- MRUCache(size_type max_size) : MRUCacheBase(max_size) {
+ MRUCache(typename ParentType::size_type max_size)
+ : ParentType(max_size) {
}
virtual ~MRUCache() {
}
private:
- DISALLOW_EVIL_CONSTRUCTORS(MRUCache);
+ DISALLOW_COPY_AND_ASSIGN(MRUCache);
};
// OwningMRUCache --------------------------------------------------------------
@@ -219,15 +224,20 @@ class OwningMRUCache
: public MRUCacheBase<KeyType,
PayloadType,
MRUCachePointerDeletor<PayloadType> > {
+ private:
+ typedef MRUCacheBase<KeyType, PayloadType,
+ MRUCachePointerDeletor<PayloadType> > ParentType;
+
public:
// See MRUCacheBase, noting the possibility of using NO_AUTO_EVICT.
- OwningMRUCache(size_type max_size) : MRUCacheBase(max_size) {
+ OwningMRUCache(typename ParentType::size_type max_size)
+ : ParentType(max_size) {
}
virtual ~OwningMRUCache() {
}
private:
- DISALLOW_EVIL_CONSTRUCTORS(OwningMRUCache);
+ DISALLOW_COPY_AND_ASSIGN(OwningMRUCache);
};
#endif // CHROME_COMMON_MRU_CACHE_H__