summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--base/compiler_specific.h2
-rw-r--r--chrome/browser/bookmarks/bookmark_html_writer_unittest.cc2
-rw-r--r--chrome/browser/browser.scons8
-rw-r--r--chrome/browser/cert_store.h2
-rw-r--r--chrome/browser/google_url_tracker_unittest.cc2
-rw-r--r--chrome/browser/history/history_backend_unittest.cc28
-rw-r--r--chrome/browser/metrics_log_unittest.cc2
-rw-r--r--chrome/browser/ssl_error_info.cc3
-rw-r--r--chrome/browser/url_fetcher.cc8
-rw-r--r--chrome/browser/url_fixer_upper_unittest.cc35
-rw-r--r--chrome/common/gfx/favicon_size.h7
11 files changed, 52 insertions, 47 deletions
diff --git a/base/compiler_specific.h b/base/compiler_specific.h
index 11777fb..50dc6f3 100644
--- a/base/compiler_specific.h
+++ b/base/compiler_specific.h
@@ -67,8 +67,10 @@
#if defined(COMPILER_GCC)
+#define ALLOW_UNUSED __attribute__((unused))
#define WARN_UNUSED_RESULT __attribute__((warn_unused_result))
#else // Not GCC
+#define ALLOW_UNUSED
#define WARN_UNUSED_RESULT
#endif
diff --git a/chrome/browser/bookmarks/bookmark_html_writer_unittest.cc b/chrome/browser/bookmarks/bookmark_html_writer_unittest.cc
index 403ad16..8f0ad23 100644
--- a/chrome/browser/bookmarks/bookmark_html_writer_unittest.cc
+++ b/chrome/browser/bookmarks/bookmark_html_writer_unittest.cc
@@ -109,7 +109,7 @@ TEST_F(BookmarkHTMLWriterTest, Test) {
NULL);
// Verify we got back what we wrote.
- ASSERT_EQ(6, parsed_bookmarks.size());
+ ASSERT_EQ(6U, parsed_bookmarks.size());
AssertBookmarkEntryEquals(parsed_bookmarks[0], false, url1, url1_title, t1,
L"Bookmark Bar", f1_title, std::wstring());
AssertBookmarkEntryEquals(parsed_bookmarks[1], false, url2, url2_title, t2,
diff --git a/chrome/browser/browser.scons b/chrome/browser/browser.scons
index cf6a6cb..4797c10 100644
--- a/chrome/browser/browser.scons
+++ b/chrome/browser/browser.scons
@@ -108,7 +108,11 @@ if env['PLATFORM'] in ('posix', 'win32'):
'session_startup_pref.cc',
'spellcheck_worditerator.cc',
'spellchecker.cc',
+ 'ssl_error_info.cc',
+ 'template_url.cc',
+ 'template_url_model.cc',
'template_url_parser.cc',
+ 'url_fetcher.cc',
'url_fetcher_protect.cc',
'user_metrics.cc',
'webdata/web_database.cc',
@@ -260,7 +264,6 @@ if env['PLATFORM'] == 'win32':
'shell_integration.cc',
'site_instance.cc',
'ssl_blocking_page.cc',
- 'ssl_error_info.cc',
'ssl_manager.cc',
'ssl_policy.cc',
'status_view.cc',
@@ -272,12 +275,9 @@ if env['PLATFORM'] == 'win32':
'tabs/tab_strip_model_order_controller.cc',
'task_manager.cc',
'task_manager_resource_providers.cc',
- 'template_url.cc',
'template_url_fetcher.cc',
- 'template_url_model.cc',
'template_url_prepopulate_data.cc',
'toolbar_model.cc',
- 'url_fetcher.cc',
'url_fixer_upper.cc',
'user_data_manager.cc',
'view_source_contents.cc',
diff --git a/chrome/browser/cert_store.h b/chrome/browser/cert_store.h
index 742151a..48b53ef 100644
--- a/chrome/browser/cert_store.h
+++ b/chrome/browser/cert_store.h
@@ -61,7 +61,7 @@ class CertStore : public NotificationObserver {
static CertStore* instance_;
typedef std::multimap<int, int> IDMap;
- typedef std::map<int, scoped_refptr<net::X509Certificate>> CertMap;
+ typedef std::map<int, scoped_refptr<net::X509Certificate> > CertMap;
typedef std::map<net::X509Certificate*, int, net::X509Certificate::LessThan>
ReverseCertMap;
diff --git a/chrome/browser/google_url_tracker_unittest.cc b/chrome/browser/google_url_tracker_unittest.cc
index 80c4976..e4a9aac 100644
--- a/chrome/browser/google_url_tracker_unittest.cc
+++ b/chrome/browser/google_url_tracker_unittest.cc
@@ -24,7 +24,7 @@ TEST(GoogleURLTrackerTest, CheckAndConvertURL) {
{ "http://google/", false, "", },
};
- for (size_t i = 0; i < arraysize(data); ++i) {
+ for (size_t i = 0; i < ARRAYSIZE_UNSAFE(data); ++i) {
GURL base_url;
const bool can_convert = GoogleURLTracker::CheckAndConvertToGoogleBaseURL(
GURL(data[i].source_url), &base_url);
diff --git a/chrome/browser/history/history_backend_unittest.cc b/chrome/browser/history/history_backend_unittest.cc
index 2f9bcf4..ea86d2e 100644
--- a/chrome/browser/history/history_backend_unittest.cc
+++ b/chrome/browser/history/history_backend_unittest.cc
@@ -57,7 +57,7 @@ class HistoryBackendTest : public testing::Test {
scoped_refptr<HistoryBackend> backend_; // Will be NULL on init failure.
scoped_ptr<InMemoryHistoryBackend> mem_backend_;
- void AddRedirectChain(const wchar_t* sequence[], int page_id) {
+ void AddRedirectChain(const char* sequence[], int page_id) {
HistoryService::RedirectList redirects;
for (int i = 0; sequence[i] != NULL; ++i)
redirects.push_back(GURL(sequence[i]));
@@ -78,7 +78,7 @@ class HistoryBackendTest : public testing::Test {
bool loaded_;
private:
- friend HistoryBackendTestDelegate;
+ friend class HistoryBackendTestDelegate;
// testing::Test
virtual void SetUp() {
@@ -104,7 +104,7 @@ class HistoryBackendTest : public testing::Test {
HistoryDetails* details) {
// Send the notifications directly to the in-memory database.
Details<HistoryDetails> det(details);
- mem_backend_->Observe(type, Source<HistoryTest>(NULL), det);
+ mem_backend_->Observe(type, Source<HistoryBackendTest>(NULL), det);
// The backend passes ownership of the details pointer to us.
delete details;
@@ -178,12 +178,12 @@ TEST_F(HistoryBackendTest, DeleteAll) {
// Get the two visits for the URLs we just added.
VisitVector visits;
backend_->db_->GetVisitsForURL(row1_id, &visits);
- ASSERT_EQ(1, visits.size());
+ ASSERT_EQ(1U, visits.size());
VisitID visit1_id = visits[0].visit_id;
visits.clear();
backend_->db_->GetVisitsForURL(row2_id, &visits);
- ASSERT_EQ(1, visits.size());
+ ASSERT_EQ(1U, visits.size());
VisitID visit2_id = visits[0].visit_id;
// The in-memory backend should have been set and it should have gotten the
@@ -234,7 +234,7 @@ TEST_F(HistoryBackendTest, DeleteAll) {
// All visits should be deleted for both URLs.
VisitVector all_visits;
backend_->db_->GetAllVisitsInRange(Time(), Time(), 0, &all_visits);
- ASSERT_EQ(0, all_visits.size());
+ ASSERT_EQ(0U, all_visits.size());
// All thumbnails should be deleted.
std::vector<unsigned char> out_data;
@@ -264,7 +264,7 @@ TEST_F(HistoryBackendTest, DeleteAll) {
backend_->text_database_->GetTextMatches(L"Body", QueryOptions(),
&text_matches,
&first_time_searched);
- EXPECT_EQ(0, text_matches.size());
+ EXPECT_EQ(0U, text_matches.size());
}
TEST_F(HistoryBackendTest, URLsNoLongerBookmarked) {
@@ -315,7 +315,7 @@ TEST_F(HistoryBackendTest, URLsNoLongerBookmarked) {
EXPECT_EQ(row2_id, backend_->db_->GetRowForURL(row2.url(), NULL));
VisitVector visits;
backend_->db_->GetVisitsForURL(row2_id, &visits);
- EXPECT_EQ(0, visits.size());
+ EXPECT_EQ(0U, visits.size());
// The favicon should still be valid.
EXPECT_EQ(favicon2,
backend_->thumbnail_db_->GetFavIconIDForFavIconURL(favicon_url2));
@@ -348,7 +348,7 @@ TEST_F(HistoryBackendTest, URLsNoLongerBookmarked) {
// There should still be visits.
visits.clear();
backend_->db_->GetVisitsForURL(row1_id, &visits);
- EXPECT_EQ(1, visits.size());
+ EXPECT_EQ(1U, visits.size());
// The favicon should still be valid.
EXPECT_EQ(favicon1,
@@ -358,9 +358,9 @@ TEST_F(HistoryBackendTest, URLsNoLongerBookmarked) {
TEST_F(HistoryBackendTest, GetPageThumbnailAfterRedirects) {
ASSERT_TRUE(backend_.get());
- const wchar_t* base_url = L"http://mail";
- const wchar_t* thumbnail_url = L"http://mail.google.com";
- const wchar_t* first_chain[] = {
+ const char* base_url = "http://mail";
+ const char* thumbnail_url = "http://mail.google.com";
+ const char* first_chain[] = {
base_url,
thumbnail_url,
NULL
@@ -376,9 +376,9 @@ TEST_F(HistoryBackendTest, GetPageThumbnailAfterRedirects) {
// Write a second URL chain so that if you were to simply check what
// "http://mail" redirects to, you wouldn't see the URL that has
// contains the thumbnail.
- const wchar_t* second_chain[] = {
+ const char* second_chain[] = {
base_url,
- L"http://mail.google.com/somewhere/else",
+ "http://mail.google.com/somewhere/else",
NULL
};
AddRedirectChain(second_chain, 1);
diff --git a/chrome/browser/metrics_log_unittest.cc b/chrome/browser/metrics_log_unittest.cc
index 65bcdab..a8fd6f8 100644
--- a/chrome/browser/metrics_log_unittest.cc
+++ b/chrome/browser/metrics_log_unittest.cc
@@ -113,7 +113,7 @@ TEST(MetricsLogTest, CreateHash) {
{"NewTab", "0x290eb683f96572f1"},
};
- for (int i = 0; i < arraysize(cases); i++) {
+ for (size_t i = 0; i < ARRAYSIZE_UNSAFE(cases); i++) {
std::string hash_string = MetricsLog::CreateHash(cases[i].input);
// Convert to hex string
diff --git a/chrome/browser/ssl_error_info.cc b/chrome/browser/ssl_error_info.cc
index 8bae914..55fe353 100644
--- a/chrome/browser/ssl_error_info.cc
+++ b/chrome/browser/ssl_error_info.cc
@@ -7,7 +7,6 @@
#include "base/string_util.h"
#include "chrome/browser/cert_store.h"
#include "chrome/common/l10n_util.h"
-#include "chrome/common/resource_bundle.h"
#include "chrome/common/time_format.h"
#include "net/base/cert_status_flags.h"
#include "net/base/net_errors.h"
@@ -235,7 +234,7 @@ int SSLErrorInfo::GetErrorsForCertStatus(int cert_id,
scoped_refptr<net::X509Certificate> cert = NULL;
int count = 0;
- for (int i = 0; i < arraysize(kErrorFlags); ++i) {
+ for (size_t i = 0; i < arraysize(kErrorFlags); ++i) {
if (cert_status & kErrorFlags[i]) {
count++;
if (!cert.get()) {
diff --git a/chrome/browser/url_fetcher.cc b/chrome/browser/url_fetcher.cc
index 388a1f6..313ae73 100644
--- a/chrome/browser/url_fetcher.cc
+++ b/chrome/browser/url_fetcher.cc
@@ -4,19 +4,19 @@
#include "chrome/browser/url_fetcher.h"
+#include "base/compiler_specific.h"
#include "base/string_util.h"
#include "base/thread.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chrome_thread.h"
-#include "chrome/browser/net/dns_master.h"
#include "googleurl/src/gurl.h"
#include "net/base/load_flags.h"
URLFetcher::URLFetcher(const GURL& url,
RequestType request_type,
Delegate* d)
-#pragma warning(suppress: 4355) // Okay to pass "this" here.
- : core_(new Core(this, url, request_type, d)) {
+ : ALLOW_THIS_IN_INITIALIZER_LIST(
+ core_(new Core(this, url, request_type, d))) {
}
URLFetcher::~URLFetcher() {
@@ -34,8 +34,8 @@ URLFetcher::Core::Core(URLFetcher* fetcher,
delegate_loop_(MessageLoop::current()),
io_loop_(ChromeThread::GetMessageLoop(ChromeThread::IO)),
request_(NULL),
- response_code_(-1),
load_flags_(net::LOAD_NORMAL),
+ response_code_(-1),
protect_entry_(URLFetcherProtectManager::GetInstance()->Register(
original_url_.host())),
num_retries_(0) {
diff --git a/chrome/browser/url_fixer_upper_unittest.cc b/chrome/browser/url_fixer_upper_unittest.cc
index e793505..7bd1baa 100644
--- a/chrome/browser/url_fixer_upper_unittest.cc
+++ b/chrome/browser/url_fixer_upper_unittest.cc
@@ -3,9 +3,10 @@
// found in the LICENSE file.
#include <stdlib.h>
-#include <windows.h>
#include "base/basictypes.h"
+#include "base/file_path.h"
+#include "base/file_util.h"
#include "base/logging.h"
#include "base/path_service.h"
#include "base/string_util.h"
@@ -95,7 +96,7 @@ TEST(URLFixerUpperTest, SegmentURL) {
std::wstring result;
url_parse::Parsed parts;
- for (int i = 0; i < arraysize(segment_cases); ++i) {
+ for (size_t i = 0; i < arraysize(segment_cases); ++i) {
segment_case value = segment_cases[i];
result = URLFixerUpper::SegmentURL(value.input, &parts);
EXPECT_EQ(value.result, result);
@@ -118,13 +119,12 @@ TEST(URLFixerUpperTest, SegmentURL) {
static bool MakeTempFile(const std::wstring& dir,
const std::wstring& file_name,
std::wstring* full_path) {
- *full_path = dir + L"\\" + file_name;
-
- HANDLE hfile = CreateFile(full_path->c_str(), GENERIC_READ | GENERIC_WRITE,
- 0, NULL, CREATE_ALWAYS, 0, NULL);
- if (hfile == NULL || hfile == INVALID_HANDLE_VALUE)
+ FilePath dir_path = FilePath::FromWStringHack(dir);
+ FilePath file_name_path = FilePath::FromWStringHack(file_name);
+ FilePath path = dir_path.Append(file_name_path.value());
+ if (!file_util::CreateTemporaryFileName(&path))
return false;
- CloseHandle(hfile);
+ *full_path = path.ToWStringHack();
return true;
}
@@ -139,7 +139,7 @@ static bool IsMatchingFileURL(const std::wstring& url,
return false; // contains backslashes
std::wstring derived_path;
- net::FileURLToFilePath(GURL(url), &derived_path);
+ net::FileURLToFilePath(GURL(WideToUTF8(url)), &derived_path);
return (derived_path.length() == full_file_path.length()) &&
std::equal(derived_path.begin(), derived_path.end(),
full_file_path.begin(), CaseInsensitiveCompare<wchar_t>());
@@ -178,7 +178,7 @@ struct fixup_case {
TEST(URLFixerUpperTest, FixupURL) {
std::wstring output;
- for (int i = 0; i < arraysize(fixup_cases); ++i) {
+ for (size_t i = 0; i < arraysize(fixup_cases); ++i) {
fixup_case value = fixup_cases[i];
output = URLFixerUpper::FixupURL(value.input, value.desired_tld);
EXPECT_EQ(value.output, output);
@@ -204,7 +204,7 @@ TEST(URLFixerUpperTest, FixupURL) {
{L"google:123", L"com", L"http://www.google.com:123/"},
{L"http://google:123", L"com", L"http://www.google.com:123/"},
};
- for (int i = 0; i < arraysize(tld_cases); ++i) {
+ for (size_t i = 0; i < arraysize(tld_cases); ++i) {
fixup_case value = tld_cases[i];
output = URLFixerUpper::FixupURL(value.input, value.desired_tld);
EXPECT_EQ(value.output, output);
@@ -260,13 +260,13 @@ TEST(URLFixerUpperTest, FixupFile) {
// {L"file://server/folder/file", L"", L"file://server/folder/file"},
// {L"file:/\\/server\\folder/file", L"", L"file://server/folder/file"},
};
- for (int i = 0; i < arraysize(file_cases); i++) {
+ for (size_t i = 0; i < arraysize(file_cases); i++) {
fixedup = URLFixerUpper::FixupURL(file_cases[i].input,
file_cases[i].desired_tld);
EXPECT_EQ(file_cases[i].output, fixedup);
}
- EXPECT_TRUE(DeleteFile(original.c_str()));
+ EXPECT_TRUE(file_util::Delete(original, false));
}
TEST(URLFixerUpperTest, FixupRelativeFile) {
@@ -277,7 +277,7 @@ TEST(URLFixerUpperTest, FixupRelativeFile) {
// make sure we pass through good URLs
std::wstring fixedup;
- for (int i = 0; i < arraysize(fixup_cases); ++i) {
+ for (size_t i = 0; i < arraysize(fixup_cases); ++i) {
fixup_case value = fixup_cases[i];
fixedup = URLFixerUpper::FixupRelativeFile(dir, value.input);
EXPECT_EQ(value.output, fixedup);
@@ -287,7 +287,7 @@ TEST(URLFixerUpperTest, FixupRelativeFile) {
// are no backslashes
fixedup = URLFixerUpper::FixupRelativeFile(dir, file_part);
EXPECT_PRED2(IsMatchingFileURL, fixedup, full_path);
- EXPECT_TRUE(DeleteFile(full_path.c_str()));
+ EXPECT_TRUE(file_util::Delete(full_path, false));
// create a filename we know doesn't exist and make sure it doesn't get
// fixed up to a file URL
@@ -301,7 +301,7 @@ TEST(URLFixerUpperTest, FixupRelativeFile) {
std::wstring sub_dir(L"url fixer-upper dir");
std::wstring sub_file(L"url fixer-upper existing file.txt");
std::wstring new_dir = dir + L"\\" + sub_dir;
- CreateDirectory(new_dir.c_str(), NULL);
+ ASSERT_TRUE(file_util::CreateDirectory(new_dir));
ASSERT_TRUE(MakeTempFile(new_dir, sub_file, &full_path));
// test file in the subdir
@@ -322,7 +322,6 @@ TEST(URLFixerUpperTest, FixupRelativeFile) {
EXPECT_PRED2(IsMatchingFileURL, fixedup, full_path);
// done with the subdir
- EXPECT_TRUE(DeleteFile(full_path.c_str()));
- EXPECT_TRUE(RemoveDirectory(new_dir.c_str()));
+ EXPECT_TRUE(file_util::Delete(new_dir, true));
}
diff --git a/chrome/common/gfx/favicon_size.h b/chrome/common/gfx/favicon_size.h
index bc5c12a..7f9aa60 100644
--- a/chrome/common/gfx/favicon_size.h
+++ b/chrome/common/gfx/favicon_size.h
@@ -5,13 +5,18 @@
#ifndef CHROME_COMMON_GFX_FAVICON_SIZE_H__
#define CHROME_COMMON_GFX_FAVICON_SIZE_H__
+#include "base/compiler_specific.h"
+
// Size (along each axis) of the favicon.
const int kFavIconSize = 16;
// If the width or height is bigger than the favicon size, a new width/height
// is calculated and returned in width/height that maintains the aspect
// ratio of the supplied values.
-static void calc_favicon_target_size(int* width, int* height) {
+static void calc_favicon_target_size(int* width, int* height) ALLOW_UNUSED;
+
+// static
+void calc_favicon_target_size(int* width, int* height) {
if (*width > kFavIconSize || *height > kFavIconSize) {
// Too big, resize it maintaining the aspect ratio.
float aspect_ratio = static_cast<float>(*width) /