diff options
author | mseaborn@chromium.org <mseaborn@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-20 01:37:19 +0000 |
---|---|---|
committer | mseaborn@chromium.org <mseaborn@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-20 01:37:19 +0000 |
commit | 76f6334342185167a22d829990103e7361c2f8d1 (patch) | |
tree | 1a9b7d2331e7b4e44330954c6b54c1fa4d5578a4 | |
parent | 7a376e31c7da59b7ac08e7d10941e74d371f6963 (diff) | |
download | chromium_src-76f6334342185167a22d829990103e7361c2f8d1.zip chromium_src-76f6334342185167a22d829990103e7361c2f8d1.tar.gz chromium_src-76f6334342185167a22d829990103e7361c2f8d1.tar.bz2 |
NaCl: Remove two uses of '#include "nacl/nacl_log.h"'
We should be using the full path for nacl_log.h, because it shouldn't
be installed into the NaCl SDK.
BUG=http://code.google.com/p/nativeclient/issues/detail?id=2908
TEST=build
Review URL: https://chromiumcodereview.appspot.com/10804034
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@147594 0039d316-1c4b-4281-b951-d872f2087c98
19 files changed, 42 insertions, 77 deletions
@@ -78,9 +78,6 @@ 'chrome_frame': { 'filepath': 'chrome_frame/', }, - 'chrome_views': { - 'filepath': 'chrome/browser/ui/views', - }, 'chromedriver': { 'filepath': 'chrome/test/webdriver|third_party/webdriver' }, @@ -428,7 +425,6 @@ 'bubble': ['alicet@chromium.org', 'msw+watch@chromium.org'], 'chrome_frame': ['amit@chromium.org', 'grt+watch@chromium.org', 'robertshield@chromium.org'], - 'chrome_views': ['tfarina@chromium.org'], 'chromedriver': ['kkania@chromium.org'], 'chromeos' : ['oshima+watch@chromium.org', 'stevenjb+watch@chromium.org'], diff --git a/chrome/browser/automation/testing_automation_provider.cc b/chrome/browser/automation/testing_automation_provider.cc index deb355f..2dcee1a 100644 --- a/chrome/browser/automation/testing_automation_provider.cc +++ b/chrome/browser/automation/testing_automation_provider.cc @@ -1152,7 +1152,7 @@ void TestingAutomationProvider::GetDownloadDirectory( DownloadManager* dlm = BrowserContext::GetDownloadManager(tab->GetBrowserContext()); *download_directory = - DownloadPrefs::FromDownloadManager(dlm)->DownloadPath(); + DownloadPrefs::FromDownloadManager(dlm)->download_path(); } } diff --git a/chrome/browser/debugger/devtools_file_helper.cc b/chrome/browser/debugger/devtools_file_helper.cc index 188c8c8..b3ea82e 100644 --- a/chrome/browser/debugger/devtools_file_helper.cc +++ b/chrome/browser/debugger/devtools_file_helper.cc @@ -4,8 +4,6 @@ #include "chrome/browser/debugger/devtools_file_helper.h" -#include <vector> - #include "base/bind.h" #include "base/callback.h" #include "base/file_util.h" @@ -20,12 +18,8 @@ #include "chrome/browser/ui/chrome_select_file_policy.h" #include "chrome/browser/ui/select_file_dialog.h" #include "chrome/common/pref_names.h" -#include "content/public/browser/browser_context.h" -#include "content/public/browser/download_manager.h" -using content::BrowserContext; using content::BrowserThread; -using content::DownloadManager; namespace { @@ -153,9 +147,8 @@ void DevToolsFileHelper::Save(const std::string& url, initial_path = g_last_save_path.Pointer()->DirName().AppendASCII( suggested_file_name); } else { - FilePath download_path = DownloadPrefs::FromDownloadManager( - BrowserContext::GetDownloadManager(profile_))->DownloadPath(); - initial_path = download_path.AppendASCII(suggested_file_name); + DownloadPrefs prefs(profile_->GetPrefs()); + initial_path = prefs.download_path().AppendASCII(suggested_file_name); } } diff --git a/chrome/browser/download/chrome_download_manager_delegate.cc b/chrome/browser/download/chrome_download_manager_delegate.cc index cffda03..87d4aa8 100644 --- a/chrome/browser/download/chrome_download_manager_delegate.cc +++ b/chrome/browser/download/chrome_download_manager_delegate.cc @@ -106,7 +106,7 @@ SafeBrowsingState::~SafeBrowsingState() {} ChromeDownloadManagerDelegate::ChromeDownloadManagerDelegate(Profile* profile) : profile_(profile), next_download_id_(0), - download_prefs_(new DownloadPrefs(profile)) { + download_prefs_(new DownloadPrefs(profile->GetPrefs())) { } ChromeDownloadManagerDelegate::~ChromeDownloadManagerDelegate() { @@ -660,7 +660,7 @@ void ChromeDownloadManagerDelegate::CheckVisitedReferrerBeforeDone( if (should_prompt && !download_manager_->LastDownloadPath().empty()) target_directory = download_manager_->LastDownloadPath(); else - target_directory = download_prefs_->DownloadPath(); + target_directory = download_prefs_->download_path(); suggested_path = target_directory.Append(generated_name); } else { DCHECK(!should_prompt); @@ -704,7 +704,7 @@ void ChromeDownloadManagerDelegate::CheckVisitedReferrerBeforeDone( this, download->GetId(), should_prompt, is_forced_path, danger_type)); #else GetReservedPath( - *download, suggested_path, download_prefs_->DownloadPath(), + *download, suggested_path, download_prefs_->download_path(), !is_forced_path, base::Bind(&ChromeDownloadManagerDelegate::OnPathReservationAvailable, this, download->GetId(), should_prompt, danger_type)); @@ -725,7 +725,7 @@ void ChromeDownloadManagerDelegate::SubstituteGDataDownloadPathCallback( return; GetReservedPath( - *download, suggested_path, download_prefs_->DownloadPath(), + *download, suggested_path, download_prefs_->download_path(), !is_forced_path, base::Bind(&ChromeDownloadManagerDelegate::OnPathReservationAvailable, this, download->GetId(), should_prompt, danger_type)); diff --git a/chrome/browser/download/download_browsertest.cc b/chrome/browser/download/download_browsertest.cc index 4b21c37..4585d77 100644 --- a/chrome/browser/download/download_browsertest.cc +++ b/chrome/browser/download/download_browsertest.cc @@ -353,7 +353,7 @@ class DownloadTest : public InProcessBrowserTest { } FilePath GetDownloadDirectory(Browser* browser) { - return GetDownloadPrefs(browser)->DownloadPath(); + return GetDownloadPrefs(browser)->download_path(); } // Create a DownloadTestObserverTerminal that will wait for the diff --git a/chrome/browser/download/download_prefs.cc b/chrome/browser/download/download_prefs.cc index e5590b6..bc8a396 100644 --- a/chrome/browser/download/download_prefs.cc +++ b/chrome/browser/download/download_prefs.cc @@ -22,14 +22,12 @@ #include "chrome/browser/download/download_util.h" #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/profiles/profile.h" -#include "chrome/browser/profiles/profile_manager.h" #include "chrome/common/pref_names.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/download_manager.h" #include "content/public/browser/save_page_type.h" #if defined(OS_CHROMEOS) -#include "chrome/browser/chromeos/gdata/gdata_system_service.h" #include "chrome/browser/chromeos/gdata/gdata_util.h" #endif @@ -37,8 +35,7 @@ using content::BrowserContext; using content::BrowserThread; using content::DownloadManager; -DownloadPrefs::DownloadPrefs(Profile* profile) : profile_(profile) { - PrefService* prefs = profile->GetPrefs(); +DownloadPrefs::DownloadPrefs(PrefService* prefs) : prefs_(prefs) { prompt_for_download_.Init(prefs::kPromptForDownload, prefs, NULL); download_path_.Init(prefs::kDownloadDefaultDirectory, prefs, NULL); save_file_type_.Init(prefs::kSaveFileType, prefs, NULL); @@ -125,18 +122,6 @@ DownloadPrefs* DownloadPrefs::FromBrowserContext( return FromDownloadManager(BrowserContext::GetDownloadManager(context)); } -FilePath DownloadPrefs::DownloadPath() const { -#if defined(OS_CHROMEOS) - // If the download path is under /drive, and GDataSystemService isn't - // available (which it isn't for incognito mode, for instance), use the - // default download directory (/Downloads). - if (gdata::util::IsUnderGDataMountPoint(*download_path_) && - !gdata::GDataSystemServiceFactory::GetForProfile(profile_)) - return download_util::GetDefaultDownloadDirectory(); -#endif - return *download_path_; -} - bool DownloadPrefs::PromptForDownload() const { // If the DownloadDirectory policy is set, then |prompt_for_download_| should // always be false. @@ -199,7 +184,7 @@ void DownloadPrefs::SaveAutoOpenState() { if (!extensions.empty()) extensions.erase(extensions.size() - 1); - profile_->GetPrefs()->SetString(prefs::kDownloadExtensionsToOpen, extensions); + prefs_->SetString(prefs::kDownloadExtensionsToOpen, extensions); } bool DownloadPrefs::AutoOpenCompareFunctor::operator()( diff --git a/chrome/browser/download/download_prefs.h b/chrome/browser/download/download_prefs.h index 86fd106..ab95eaf 100644 --- a/chrome/browser/download/download_prefs.h +++ b/chrome/browser/download/download_prefs.h @@ -1,4 +1,4 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -10,7 +10,7 @@ #include "base/file_path.h" #include "chrome/browser/prefs/pref_member.h" -class Profile; +class PrefService; namespace content { class BrowserContext; @@ -20,7 +20,7 @@ class DownloadManager; // Stores all download-related preferences. class DownloadPrefs { public: - explicit DownloadPrefs(Profile* profile); + explicit DownloadPrefs(PrefService* prefs); ~DownloadPrefs(); static void RegisterUserPrefs(PrefService* prefs); @@ -32,7 +32,7 @@ class DownloadPrefs { static DownloadPrefs* FromBrowserContext( content::BrowserContext* browser_context); - FilePath DownloadPath() const; + FilePath download_path() const { return *download_path_; } int save_file_type() const { return *save_file_type_; } // Returns true if the prompt_for_download preference has been set and the @@ -62,7 +62,7 @@ class DownloadPrefs { private: void SaveAutoOpenState(); - Profile* profile_; + PrefService* prefs_; BooleanPrefMember prompt_for_download_; FilePathPrefMember download_path_; diff --git a/chrome/browser/download/save_page_browsertest.cc b/chrome/browser/download/save_page_browsertest.cc index 0d4a106..66e2843 100644 --- a/chrome/browser/download/save_page_browsertest.cc +++ b/chrome/browser/download/save_page_browsertest.cc @@ -352,7 +352,7 @@ IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, CleanFilenameFromPageTitle) { const FilePath file_name(FILE_PATH_LITERAL("c.htm")); FilePath download_dir = DownloadPrefs::FromDownloadManager(GetDownloadManager())-> - DownloadPath(); + download_path(); FilePath full_file_name = download_dir.AppendASCII(std::string("test.exe") + kAppendedExtension); FilePath dir = download_dir.AppendASCII("test.exe_files"); @@ -395,7 +395,7 @@ IN_PROC_BROWSER_TEST_F(SavePageAsMHTMLBrowserTest, SavePageAsMHTML) { static const int64 kFileSizeMin = 2758; GURL url = NavigateToMockURL("b"); FilePath download_dir = DownloadPrefs::FromDownloadManager( - GetDownloadManager())->DownloadPath(); + GetDownloadManager())->download_path(); FilePath full_file_name = download_dir.AppendASCII(std::string( "Test page for saving page feature.mhtml")); #if defined(OS_CHROMEOS) diff --git a/chrome/browser/extensions/api/serial/serial_api.cc b/chrome/browser/extensions/api/serial/serial_api.cc index 80a2646..57e33b0 100644 --- a/chrome/browser/extensions/api/serial/serial_api.cc +++ b/chrome/browser/extensions/api/serial/serial_api.cc @@ -236,8 +236,8 @@ bool SerialWriteFunction::Prepare() { params_ = api::experimental_serial::Write::Params::Create(*args_); EXTENSION_FUNCTION_VALIDATE(params_.get()); - io_buffer_size_ = params_->data.size(); - io_buffer_ = new net::WrappedIOBuffer(params_->data.data()); + io_buffer_size_ = params_->data->GetSize(); + io_buffer_ = new net::WrappedIOBuffer(params_->data->GetBuffer()); return true; } diff --git a/chrome/browser/extensions/api/usb/usb_device_resource.cc b/chrome/browser/extensions/api/usb/usb_device_resource.cc index da8efdf..8d8525c 100644 --- a/chrome/browser/extensions/api/usb/usb_device_resource.cc +++ b/chrome/browser/extensions/api/usb/usb_device_resource.cc @@ -101,7 +101,7 @@ static bool GetTransferSize(const T& input, size_t* output) { } } else if (input.direction == kDirectionOut) { if (input.data.get()) { - *output = input.data->size(); + *output = input.data->GetSize(); return true; } } @@ -120,7 +120,7 @@ static scoped_refptr<net::IOBuffer> CreateBufferForTransfer(const T& input) { return buffer; } - memcpy(buffer->data(), input.data->data(), size); + memcpy(buffer->data(), input.data->GetBuffer(), size); return buffer; } diff --git a/chrome/browser/extensions/webstore_installer.cc b/chrome/browser/extensions/webstore_installer.cc index 4bf576a..faf29c9 100644 --- a/chrome/browser/extensions/webstore_installer.cc +++ b/chrome/browser/extensions/webstore_installer.cc @@ -206,7 +206,7 @@ void WebstoreInstaller::Start() { } FilePath download_path = DownloadPrefs::FromDownloadManager( - BrowserContext::GetDownloadManager(profile_))->DownloadPath(); + BrowserContext::GetDownloadManager(profile_))->download_path(); BrowserThread::PostTask( BrowserThread::FILE, FROM_HERE, base::Bind(&GetDownloadFilePath, download_path, id_, diff --git a/chrome/browser/ui/ash/screenshot_taker.cc b/chrome/browser/ui/ash/screenshot_taker.cc index 3e9d655..12e6bd2 100644 --- a/chrome/browser/ui/ash/screenshot_taker.cc +++ b/chrome/browser/ui/ash/screenshot_taker.cc @@ -153,7 +153,7 @@ void ScreenshotTaker::HandleTakePartialScreenshot( if (is_logged_in) { DownloadPrefs* download_prefs = DownloadPrefs::FromBrowserContext( ash::Shell::GetInstance()->delegate()->GetCurrentBrowserContext()); - screenshot_directory = download_prefs->DownloadPath(); + screenshot_directory = download_prefs->download_path(); } else { if (!file_util::GetTempDir(&screenshot_directory)) { LOG(ERROR) << "Failed to find temporary directory."; diff --git a/chrome/browser/ui/webui/downloads_dom_handler.cc b/chrome/browser/ui/webui/downloads_dom_handler.cc index 514ae7a..d10d8e6 100644 --- a/chrome/browser/ui/webui/downloads_dom_handler.cc +++ b/chrome/browser/ui/webui/downloads_dom_handler.cc @@ -341,7 +341,7 @@ void DownloadsDOMHandler::HandleClearAll(const ListValue* args) { void DownloadsDOMHandler::HandleOpenDownloadsFolder(const ListValue* args) { CountDownloadsDOMEvents(DOWNLOADS_DOM_EVENT_OPEN_FOLDER); platform_util::OpenItem( - DownloadPrefs::FromDownloadManager(download_manager_)->DownloadPath()); + DownloadPrefs::FromDownloadManager(download_manager_)->download_path()); } // DownloadsDOMHandler, private: ---------------------------------------------- diff --git a/chrome/browser/ui/webui/feedback_ui.cc b/chrome/browser/ui/webui/feedback_ui.cc index 83bbe87..96ea099 100644 --- a/chrome/browser/ui/webui/feedback_ui.cc +++ b/chrome/browser/ui/webui/feedback_ui.cc @@ -98,7 +98,7 @@ void GetSavedScreenshots(std::vector<std::string>* saved_screenshots) { DownloadPrefs* download_prefs = DownloadPrefs::FromBrowserContext( ash::Shell::GetInstance()->delegate()->GetCurrentBrowserContext()); FeedbackUI::GetMostRecentScreenshots( - download_prefs->DownloadPath(), + download_prefs->download_path(), saved_screenshots, kMaxSavedScreenshots); } diff --git a/chrome/browser/ui/webui/screenshot_source.cc b/chrome/browser/ui/webui/screenshot_source.cc index 15d0d57..9a7798f 100644 --- a/chrome/browser/ui/webui/screenshot_source.cc +++ b/chrome/browser/ui/webui/screenshot_source.cc @@ -104,7 +104,7 @@ void ScreenshotSource::SendSavedScreenshot(const std::string& screenshot_path, int64 file_size = 0; DownloadPrefs* download_prefs = DownloadPrefs::FromBrowserContext( ash::Shell::GetInstance()->delegate()->GetCurrentBrowserContext()); - FilePath file = download_prefs->DownloadPath().Append(decoded_filename); + FilePath file = download_prefs->download_path().Append(decoded_filename); if (!file_util::GetFileSize(file, &file_size)) { CacheAndSendScreenshot(screenshot_path, request_id, read_bytes); return; diff --git a/ppapi/native_client/tests/ppapi_browser/ppb_audio/ppapi_ppb_audio.cc b/ppapi/native_client/tests/ppapi_browser/ppb_audio/ppapi_ppb_audio.cc index 1dfc314..14dd93e 100644 --- a/ppapi/native_client/tests/ppapi_browser/ppb_audio/ppapi_ppb_audio.cc +++ b/ppapi/native_client/tests/ppapi_browser/ppb_audio/ppapi_ppb_audio.cc @@ -3,8 +3,6 @@ // found in the LICENSE file. // -#include <nacl/nacl_log.h> - #include <stdint.h> #include <stdio.h> #include <stdlib.h> @@ -16,7 +14,6 @@ #include "native_client/src/include/nacl_macros.h" #include "native_client/src/include/nacl/nacl_inttypes.h" -#include "native_client/src/shared/platform/nacl_check.h" #include "native_client/src/shared/ppapi_proxy/utility.h" #include "native_client/tests/ppapi_test_lib/get_browser_interface.h" #include "native_client/tests/ppapi_test_lib/test_interface.h" diff --git a/ppapi/native_client/tests/ppapi_example_audio/audio.cc b/ppapi/native_client/tests/ppapi_example_audio/audio.cc index e2c6a32..4574b30 100644 --- a/ppapi/native_client/tests/ppapi_example_audio/audio.cc +++ b/ppapi/native_client/tests/ppapi_example_audio/audio.cc @@ -3,8 +3,6 @@ // found in the LICENSE file. // -#include <nacl/nacl_log.h> - #include <stdint.h> #include <stdio.h> #include <stdlib.h> @@ -14,6 +12,7 @@ #include <limits> #include <string> #include "native_client/src/include/nacl/nacl_inttypes.h" +#include "native_client/src/shared/platform/nacl_log.h" #include "native_client/src/shared/ppapi_proxy/utility.h" #include "ppapi/c/pp_bool.h" #include "ppapi/c/pp_errors.h" diff --git a/tools/json_schema_compiler/cc_generator.py b/tools/json_schema_compiler/cc_generator.py index 770ae48..d21e160 100644 --- a/tools/json_schema_compiler/cc_generator.py +++ b/tools/json_schema_compiler/cc_generator.py @@ -355,12 +355,7 @@ class CCGenerator(object): elif prop.type_ == PropertyType.ENUM: return 'CreateEnumValue(%s).release()' % var elif prop.type_ == PropertyType.BINARY: - if prop.optional: - vardot = var + '->' - else: - vardot = var + '.' - return ('base::BinaryValue::CreateWithCopiedBuffer(%sdata(), %ssize())' % - (vardot, vardot)) + return '%s->DeepCopy()' % var elif self._IsArrayOrArrayRef(prop): return '%s.release()' % self._util_cc_helper.CreateValueFromArray( self._cpp_type_generator.GetReferencedProperty(prop), var, @@ -547,20 +542,15 @@ class CCGenerator(object): c.Append('%(dst)s->%(name)s = enum_temp;') c.Eblock('}') elif prop.type_ == PropertyType.BINARY: + # This is the same if the property is optional or not. We need a pointer + # to the base::BinaryValue to be able to populate it, so a scoped_ptr is + # used whether it is optional or required. (c.Append('if (!%(value_var)s->IsType(%(value_type)s))') .Append(' return %(failure_value)s;') - .Append('base::BinaryValue* binary_value =') - .Append(' static_cast<base::BinaryValue*>(%(value_var)s);') - ) - if prop.optional: - (c.Append('%(dst)s->%(name)s.reset(') - .Append(' new std::string(binary_value->GetBuffer(),') - .Append(' binary_value->GetSize()));') - ) - else: - (c.Append('%(dst)s->%(name)s.assign(binary_value->GetBuffer(),') - .Append(' binary_value->GetSize());') - ) + .Append('%(dst)s->%(name)s.reset(') + .Append(' static_cast<base::BinaryValue*>(%(value_var)s)' + '->DeepCopy());') + ) else: raise NotImplementedError(prop.type_) c.Eblock('}') diff --git a/tools/json_schema_compiler/cpp_type_generator.py b/tools/json_schema_compiler/cpp_type_generator.py index f398c75..5b54bae 100644 --- a/tools/json_schema_compiler/cpp_type_generator.py +++ b/tools/json_schema_compiler/cpp_type_generator.py @@ -127,6 +127,7 @@ class CppTypeGenerator(object): optional. """ cpp_type = None + force_wrapping = False if prop.type_ == PropertyType.REF: dependency_namespace = self._ResolveTypeNamespace(prop.ref_type) if not dependency_namespace: @@ -164,13 +165,17 @@ class CppTypeGenerator(object): cpp_type = cpp_type % self.GetType( prop.item_type, pad_for_generics=True) elif prop.type_ == PropertyType.BINARY: - cpp_type = 'std::string' + # Since base::BinaryValue's are immutable, we wrap them in a scoped_ptr to + # allow them to be modified after the fact. + force_wrapping = True + cpp_type = 'base::BinaryValue' else: raise NotImplementedError(prop.type_) # Enums aren't wrapped because C++ won't allow it. Optional enums have a # NONE value generated instead. - if wrap_optional and prop.optional and prop.type_ != PropertyType.ENUM: + if force_wrapping or (wrap_optional and prop.optional and prop.type_ != + PropertyType.ENUM): cpp_type = 'scoped_ptr<%s> ' % cpp_type if pad_for_generics: return cpp_type |