diff options
23 files changed, 66 insertions, 34 deletions
diff --git a/chrome/browser/browser_about_handler.cc b/chrome/browser/browser_about_handler.cc index 9044705..ad517f3 100644 --- a/chrome/browser/browser_about_handler.cc +++ b/chrome/browser/browser_about_handler.cc @@ -119,7 +119,9 @@ class AboutSource : public ChromeURLDataManager::DataSource { // Called when the network layer has requested a resource underneath // the path we registered. - virtual void StartDataRequest(const std::string& path, int request_id); + virtual void StartDataRequest(const std::string& path, + bool is_off_the_record, + int request_id); virtual std::string GetMimeType(const std::string&) const { return "text/html"; @@ -598,7 +600,7 @@ AboutSource::~AboutSource() { } void AboutSource::StartDataRequest(const std::string& path_raw, - int request_id) { + bool is_off_the_record, int request_id) { std::string path = path_raw; std::string info; if (path.find("/") != std::string::npos) { diff --git a/chrome/browser/dom_ui/chrome_url_data_manager.cc b/chrome/browser/dom_ui/chrome_url_data_manager.cc index a2ea998..f4cb9a0 100644 --- a/chrome/browser/dom_ui/chrome_url_data_manager.cc +++ b/chrome/browser/dom_ui/chrome_url_data_manager.cc @@ -14,6 +14,7 @@ #include "base/values.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/chrome_thread.h" +#include "chrome/browser/net/chrome_url_request_context.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/ref_counted_util.h" #include "chrome/common/url_constants.h" @@ -228,19 +229,22 @@ bool ChromeURLDataManager::StartRequest(const GURL& url, // going to get called once we return. job->SetMimeType(source->GetMimeType(path)); + ChromeURLRequestContext* context = static_cast<ChromeURLRequestContext*>( + job->request()->context()); + // Forward along the request to the data source. MessageLoop* target_message_loop = source->MessageLoopForRequestPath(path); if (!target_message_loop) { // The DataSource is agnostic to which thread StartDataRequest is called // on for this path. Call directly into it from this thread, the IO // thread. - source->StartDataRequest(path, request_id); + source->StartDataRequest(path, context->is_off_the_record(), request_id); } else { // The DataSource wants StartDataRequest to be called on a specific thread, // usually the UI thread, for this path. target_message_loop->PostTask(FROM_HERE, NewRunnableMethod(source, &DataSource::StartDataRequest, - path, request_id)); + path, context->is_off_the_record(), request_id)); } return true; } diff --git a/chrome/browser/dom_ui/chrome_url_data_manager.h b/chrome/browser/dom_ui/chrome_url_data_manager.h index f553a3f..16f2239 100644 --- a/chrome/browser/dom_ui/chrome_url_data_manager.h +++ b/chrome/browser/dom_ui/chrome_url_data_manager.h @@ -48,7 +48,9 @@ class ChromeURLDataManager { // Sent by the DataManager to request data at |path|. The source should // call SendResponse() when the data is available or if the request could // not be satisfied. - virtual void StartDataRequest(const std::string& path, int request_id) = 0; + virtual void StartDataRequest(const std::string& path, + bool is_off_the_record, + int request_id) = 0; // Return the mimetype that should be sent with this response, or empty // string to specify no mime type. diff --git a/chrome/browser/dom_ui/dom_ui_favicon_source.cc b/chrome/browser/dom_ui/dom_ui_favicon_source.cc index 536e175..dfb4d40 100644 --- a/chrome/browser/dom_ui/dom_ui_favicon_source.cc +++ b/chrome/browser/dom_ui/dom_ui_favicon_source.cc @@ -15,7 +15,7 @@ DOMUIFavIconSource::DOMUIFavIconSource(Profile* profile) } void DOMUIFavIconSource::StartDataRequest(const std::string& path, - int request_id) { + bool is_off_the_record, int request_id) { FaviconService* favicon_service = profile_->GetFaviconService(Profile::EXPLICIT_ACCESS); if (favicon_service) { diff --git a/chrome/browser/dom_ui/dom_ui_favicon_source.h b/chrome/browser/dom_ui/dom_ui_favicon_source.h index 0d42eaf..b0db79b 100644 --- a/chrome/browser/dom_ui/dom_ui_favicon_source.h +++ b/chrome/browser/dom_ui/dom_ui_favicon_source.h @@ -23,7 +23,9 @@ class DOMUIFavIconSource : public ChromeURLDataManager::DataSource { // Called when the network layer has requested a resource underneath // the path we registered. - virtual void StartDataRequest(const std::string& path, int request_id); + virtual void StartDataRequest(const std::string& path, + bool is_off_the_record, + int request_id); virtual std::string GetMimeType(const std::string&) const { // We need to explicitly return a mime type, otherwise if the user tries to diff --git a/chrome/browser/dom_ui/dom_ui_theme_source.cc b/chrome/browser/dom_ui/dom_ui_theme_source.cc index 768c589..e5e473f 100644 --- a/chrome/browser/dom_ui/dom_ui_theme_source.cc +++ b/chrome/browser/dom_ui/dom_ui_theme_source.cc @@ -60,7 +60,7 @@ DOMUIThemeSource::DOMUIThemeSource(Profile* profile) } void DOMUIThemeSource::StartDataRequest(const std::string& path, - int request_id) { + bool is_off_the_record, int request_id) { // Our path may include cachebuster arguments, so trim them off. std::string uncached_path = StripQueryParams(path); diff --git a/chrome/browser/dom_ui/dom_ui_theme_source.h b/chrome/browser/dom_ui/dom_ui_theme_source.h index c72727d..be3a42a 100644 --- a/chrome/browser/dom_ui/dom_ui_theme_source.h +++ b/chrome/browser/dom_ui/dom_ui_theme_source.h @@ -19,7 +19,9 @@ class DOMUIThemeSource : public ChromeURLDataManager::DataSource { // Called when the network layer has requested a resource underneath // the path we registered. - virtual void StartDataRequest(const std::string& path, int request_id); + virtual void StartDataRequest(const std::string& path, + bool is_off_the_record, + int request_id); virtual std::string GetMimeType(const std::string& path) const; virtual void SendResponse(int request_id, RefCountedMemory* data); diff --git a/chrome/browser/dom_ui/dom_ui_theme_source_unittest.cc b/chrome/browser/dom_ui/dom_ui_theme_source_unittest.cc index 09e98b2..ecbdfa7 100644 --- a/chrome/browser/dom_ui/dom_ui_theme_source_unittest.cc +++ b/chrome/browser/dom_ui/dom_ui_theme_source_unittest.cc @@ -60,12 +60,12 @@ TEST_F(DOMUISourcesTest, ThemeSourceMimeTypes) { TEST_F(DOMUISourcesTest, ThemeSourceImages) { // We used to PNGEncode the images ourselves, but encoder differences // invalidated that. We now just check that the image exists. - theme_source()->StartDataRequest("theme_frame_incognito", 1); + theme_source()->StartDataRequest("theme_frame_incognito", true, 1); size_t min = 0; EXPECT_EQ(theme_source()->result_request_id_, 1); EXPECT_GT(theme_source()->result_data_size_, min); - theme_source()->StartDataRequest("theme_toolbar", 2); + theme_source()->StartDataRequest("theme_toolbar", true, 2); EXPECT_EQ(theme_source()->result_request_id_, 2); EXPECT_GT(theme_source()->result_data_size_, min); } @@ -77,16 +77,16 @@ TEST_F(DOMUISourcesTest, ThemeSourceCSS) { // just check for a successful request and data that is non-null. size_t empty_size = 0; - theme_source()->StartDataRequest("css/newtab.css", 1); + theme_source()->StartDataRequest("css/newtab.css", false, 1); EXPECT_EQ(theme_source()->result_request_id_, 1); EXPECT_NE(theme_source()->result_data_size_, empty_size); - theme_source()->StartDataRequest("css/newtab.css?pie", 3); + theme_source()->StartDataRequest("css/newtab.css?pie", false, 3); EXPECT_EQ(theme_source()->result_request_id_, 3); EXPECT_NE(theme_source()->result_data_size_, empty_size); // Check that we send NULL back when we can't find what we're looking for. - theme_source()->StartDataRequest("css/WRONGURL", 7); + theme_source()->StartDataRequest("css/WRONGURL", false, 7); EXPECT_EQ(theme_source()->result_request_id_, 7); EXPECT_EQ(theme_source()->result_data_size_, empty_size); } diff --git a/chrome/browser/dom_ui/dom_ui_thumbnail_source.cc b/chrome/browser/dom_ui/dom_ui_thumbnail_source.cc index c455b26..f707e7e 100644 --- a/chrome/browser/dom_ui/dom_ui_thumbnail_source.cc +++ b/chrome/browser/dom_ui/dom_ui_thumbnail_source.cc @@ -22,7 +22,7 @@ DOMUIThumbnailSource::DOMUIThumbnailSource(Profile* profile) } void DOMUIThumbnailSource::StartDataRequest(const std::string& path, - int request_id) { + bool is_off_the_record, int request_id) { if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kThumbnailStore)) { scoped_refptr<ThumbnailStore> store_ = profile_->GetThumbnailStore(); diff --git a/chrome/browser/dom_ui/dom_ui_thumbnail_source.h b/chrome/browser/dom_ui/dom_ui_thumbnail_source.h index 03263b2..0895a12 100644 --- a/chrome/browser/dom_ui/dom_ui_thumbnail_source.h +++ b/chrome/browser/dom_ui/dom_ui_thumbnail_source.h @@ -27,7 +27,9 @@ class DOMUIThumbnailSource : public ChromeURLDataManager::DataSource, // Called when the network layer has requested a resource underneath // the path we registered. - virtual void StartDataRequest(const std::string& path, int request_id); + virtual void StartDataRequest(const std::string& path, + bool is_off_the_record, + int request_id); virtual std::string GetMimeType(const std::string&) const { // We need to explicitly return a mime type, otherwise if the user tries to diff --git a/chrome/browser/dom_ui/downloads_ui.cc b/chrome/browser/dom_ui/downloads_ui.cc index 5dff5b9..e36654f 100644 --- a/chrome/browser/dom_ui/downloads_ui.cc +++ b/chrome/browser/dom_ui/downloads_ui.cc @@ -35,7 +35,9 @@ class DownloadsUIHTMLSource : public ChromeURLDataManager::DataSource { // Called when the network layer has requested a resource underneath // the path we registered. - virtual void StartDataRequest(const std::string& path, int request_id); + virtual void StartDataRequest(const std::string& path, + bool is_off_the_record, + int request_id); virtual std::string GetMimeType(const std::string&) const { return "text/html"; } @@ -51,7 +53,7 @@ DownloadsUIHTMLSource::DownloadsUIHTMLSource() } void DownloadsUIHTMLSource::StartDataRequest(const std::string& path, - int request_id) { + bool is_off_the_record, int request_id) { DictionaryValue localized_strings; localized_strings.SetString(L"title", l10n_util::GetString(IDS_DOWNLOAD_TITLE)); diff --git a/chrome/browser/dom_ui/filebrowse_ui.cc b/chrome/browser/dom_ui/filebrowse_ui.cc index 8f957f5..48ed389 100644 --- a/chrome/browser/dom_ui/filebrowse_ui.cc +++ b/chrome/browser/dom_ui/filebrowse_ui.cc @@ -46,7 +46,9 @@ class FileBrowseUIHTMLSource : public ChromeURLDataManager::DataSource { // Called when the network layer has requested a resource underneath // the path we registered. - virtual void StartDataRequest(const std::string& path, int request_id); + virtual void StartDataRequest(const std::string& path, + bool is_off_the_record, + int request_id); virtual std::string GetMimeType(const std::string&) const { return "text/html"; } @@ -108,7 +110,7 @@ FileBrowseUIHTMLSource::FileBrowseUIHTMLSource() } void FileBrowseUIHTMLSource::StartDataRequest(const std::string& path, - int request_id) { + bool is_off_the_record, int request_id) { DictionaryValue localized_strings; // TODO(dhg): Add stirings to localized strings, also add more strings // that are currently hardcoded. diff --git a/chrome/browser/dom_ui/fileicon_source.cc b/chrome/browser/dom_ui/fileicon_source.cc index 7a423d0..a5107d2 100644 --- a/chrome/browser/dom_ui/fileicon_source.cc +++ b/chrome/browser/dom_ui/fileicon_source.cc @@ -22,7 +22,7 @@ FileIconSource::~FileIconSource() { } void FileIconSource::StartDataRequest(const std::string& path, - int request_id) { + bool is_off_the_record, int request_id) { IconManager* im = g_browser_process->icon_manager(); std::string escaped_path = UnescapeURLComponent(path, UnescapeRule::SPACES); diff --git a/chrome/browser/dom_ui/fileicon_source.h b/chrome/browser/dom_ui/fileicon_source.h index a9f43d7..2f32262 100644 --- a/chrome/browser/dom_ui/fileicon_source.h +++ b/chrome/browser/dom_ui/fileicon_source.h @@ -21,7 +21,9 @@ class FileIconSource : public ChromeURLDataManager::DataSource { // Called when the network layer has requested a resource underneath // the path we registered. - virtual void StartDataRequest(const std::string& path, int request_id); + virtual void StartDataRequest(const std::string& path, + bool is_off_the_record, + int request_id); virtual std::string GetMimeType(const std::string&) const { // Rely on image decoder inferring the correct type. diff --git a/chrome/browser/dom_ui/history_ui.cc b/chrome/browser/dom_ui/history_ui.cc index c998230..dce9cdb 100644 --- a/chrome/browser/dom_ui/history_ui.cc +++ b/chrome/browser/dom_ui/history_ui.cc @@ -47,7 +47,7 @@ HistoryUIHTMLSource::HistoryUIHTMLSource() } void HistoryUIHTMLSource::StartDataRequest(const std::string& path, - int request_id) { + bool is_off_the_record, int request_id) { DictionaryValue localized_strings; localized_strings.SetString(L"loading", l10n_util::GetString(IDS_HISTORY_LOADING)); diff --git a/chrome/browser/dom_ui/history_ui.h b/chrome/browser/dom_ui/history_ui.h index 990c423..c1d4262 100644 --- a/chrome/browser/dom_ui/history_ui.h +++ b/chrome/browser/dom_ui/history_ui.h @@ -23,7 +23,9 @@ class HistoryUIHTMLSource : public ChromeURLDataManager::DataSource { // Called when the network layer has requested a resource underneath // the path we registered. - virtual void StartDataRequest(const std::string& path, int request_id); + virtual void StartDataRequest(const std::string& path, + bool is_off_the_record, + int request_id); virtual std::string GetMimeType(const std::string&) const { return "text/html"; } diff --git a/chrome/browser/dom_ui/new_tab_ui.cc b/chrome/browser/dom_ui/new_tab_ui.cc index b319fb5..3cc1dd6 100644 --- a/chrome/browser/dom_ui/new_tab_ui.cc +++ b/chrome/browser/dom_ui/new_tab_ui.cc @@ -130,7 +130,9 @@ class IncognitoTabHTMLSource : public ChromeURLDataManager::DataSource { // Called when the network layer has requested a resource underneath // the path we registered. - virtual void StartDataRequest(const std::string& path, int request_id); + virtual void StartDataRequest(const std::string& path, + bool is_off_the_record, + int request_id); virtual std::string GetMimeType(const std::string&) const { return "text/html"; @@ -170,7 +172,7 @@ IncognitoTabHTMLSource::IncognitoTabHTMLSource(bool bookmark_bar_attached) } void IncognitoTabHTMLSource::StartDataRequest(const std::string& path, - int request_id) { + bool is_off_the_record, int request_id) { scoped_refptr<RefCountedBytes> html_bytes(new RefCountedBytes); html_bytes->data.resize(full_html_.size()); std::copy(full_html_.begin(), full_html_.end(), html_bytes->data.begin()); @@ -769,7 +771,7 @@ NewTabUI::NewTabHTMLSource::NewTabHTMLSource(Profile* profile) } void NewTabUI::NewTabHTMLSource::StartDataRequest(const std::string& path, - int request_id) { + bool is_off_the_record, int request_id) { DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO)); if (!path.empty()) { // A path under new-tab was requested; it's likely a bad relative diff --git a/chrome/browser/dom_ui/new_tab_ui.h b/chrome/browser/dom_ui/new_tab_ui.h index f7f0349..b00aca8 100644 --- a/chrome/browser/dom_ui/new_tab_ui.h +++ b/chrome/browser/dom_ui/new_tab_ui.h @@ -55,7 +55,9 @@ class NewTabUI : public DOMUI, // Called when the network layer has requested a resource underneath // the path we registered. - virtual void StartDataRequest(const std::string& path, int request_id); + virtual void StartDataRequest(const std::string& path, + bool is_off_the_record, + int request_id); virtual std::string GetMimeType(const std::string&) const { return "text/html"; diff --git a/chrome/browser/dom_ui/print_ui.cc b/chrome/browser/dom_ui/print_ui.cc index bbdd3eb..31146ab 100644 --- a/chrome/browser/dom_ui/print_ui.cc +++ b/chrome/browser/dom_ui/print_ui.cc @@ -46,7 +46,7 @@ PrintUIHTMLSource::PrintUIHTMLSource() } void PrintUIHTMLSource::StartDataRequest(const std::string& path, - int request_id) { + bool is_off_the_record, int request_id) { // Setup a dictionary so that the html page could read the values. DictionaryValue localized_strings; localized_strings.SetString(L"title", l10n_util::GetString(IDS_PRINT)); diff --git a/chrome/browser/dom_ui/print_ui.h b/chrome/browser/dom_ui/print_ui.h index 508a6c4..02b1d0d 100644 --- a/chrome/browser/dom_ui/print_ui.h +++ b/chrome/browser/dom_ui/print_ui.h @@ -25,7 +25,9 @@ class PrintUIHTMLSource : public ChromeURLDataManager::DataSource { PrintUIHTMLSource(); // ChromeURLDataManager overrides. - virtual void StartDataRequest(const std::string& path, int request_id); + virtual void StartDataRequest(const std::string& path, + bool is_off_the_record, + int request_id); virtual std::string GetMimeType(const std::string&) const { return "text/html"; } diff --git a/chrome/browser/extensions/extensions_ui.cc b/chrome/browser/extensions/extensions_ui.cc index c8bcc06..14ae1db 100644 --- a/chrome/browser/extensions/extensions_ui.cc +++ b/chrome/browser/extensions/extensions_ui.cc @@ -54,7 +54,7 @@ ExtensionsUIHTMLSource::ExtensionsUIHTMLSource() } void ExtensionsUIHTMLSource::StartDataRequest(const std::string& path, - int request_id) { + bool is_off_the_record, int request_id) { DictionaryValue localized_strings; localized_strings.SetString(L"title", l10n_util::GetString(IDS_EXTENSIONS_TITLE)); diff --git a/chrome/browser/extensions/extensions_ui.h b/chrome/browser/extensions/extensions_ui.h index d2fe206..21715ba 100644 --- a/chrome/browser/extensions/extensions_ui.h +++ b/chrome/browser/extensions/extensions_ui.h @@ -43,7 +43,9 @@ class ExtensionsUIHTMLSource : public ChromeURLDataManager::DataSource { // Called when the network layer has requested a resource underneath // the path we registered. - virtual void StartDataRequest(const std::string& path, int request_id); + virtual void StartDataRequest(const std::string& path, + bool is_off_the_record, + int request_id); virtual std::string GetMimeType(const std::string&) const { return "text/html"; } diff --git a/chrome/browser/sync/sync_setup_wizard.cc b/chrome/browser/sync/sync_setup_wizard.cc index f69e797..e6f7bd8 100644 --- a/chrome/browser/sync/sync_setup_wizard.cc +++ b/chrome/browser/sync/sync_setup_wizard.cc @@ -26,7 +26,9 @@ class SyncResourcesSource : public ChromeURLDataManager::DataSource { : DataSource(chrome::kSyncResourcesHost, MessageLoop::current()) { } - virtual void StartDataRequest(const std::string& path, int request_id); + virtual void StartDataRequest(const std::string& path, + bool is_off_the_record, + int request_id); virtual std::string GetMimeType(const std::string& path) const { if (path == chrome::kSyncThrobberPath) @@ -58,7 +60,7 @@ const char* SyncResourcesSource::kCreateNewAccountUrl = "https://www.google.com/accounts/NewAccount?service=chromiumsync"; void SyncResourcesSource::StartDataRequest(const std::string& path_raw, - int request_id) { + bool is_off_the_record, int request_id) { scoped_refptr<RefCountedBytes> html_bytes(new RefCountedBytes); if (path_raw == chrome::kSyncThrobberPath) { scoped_refptr<RefCountedMemory> throbber( |