diff options
author | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-01 18:22:08 +0000 |
---|---|---|
committer | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-01 18:22:08 +0000 |
commit | 99456fa405621e0bccaae65119f46f1e290f4c71 (patch) | |
tree | 3514ad98d02e925a952340c88be176890897332d | |
parent | 9afd71dd7a1cfc7ef8286c881f0eaf1e659fb006 (diff) | |
download | chromium_src-99456fa405621e0bccaae65119f46f1e290f4c71.zip chromium_src-99456fa405621e0bccaae65119f46f1e290f4c71.tar.gz chromium_src-99456fa405621e0bccaae65119f46f1e290f4c71.tar.bz2 |
content/browser: Remove more unnecessary content:: calls.
R=jam@chromium.org
Review URL: https://chromiumcodereview.appspot.com/11343062
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@165439 0039d316-1c4b-4281-b951-d872f2087c98
6 files changed, 53 insertions, 61 deletions
diff --git a/content/browser/download/drag_download_file.cc b/content/browser/download/drag_download_file.cc index 71d4aae..ffedcba 100644 --- a/content/browser/download/drag_download_file.cc +++ b/content/browser/download/drag_download_file.cc @@ -22,7 +22,7 @@ namespace { typedef base::Callback<void(bool)> OnCompleted; -} // anonymous namespace +} // namespace // On windows, DragDownloadFile runs on a thread other than the UI thread. // DownloadItem and DownloadManager may not be accessed on any thread other than @@ -31,13 +31,12 @@ typedef base::Callback<void(bool)> OnCompleted; // on the UI thread. On platforms where DragDownloadFile runs on the UI thread, // none of the PostTasks are necessary, but it simplifies the code to do them // anyway. -class DragDownloadFile::DragDownloadFileUI - : public content::DownloadItem::Observer { +class DragDownloadFile::DragDownloadFileUI : public DownloadItem::Observer { public: DragDownloadFileUI(const GURL& url, - const content::Referrer& referrer, + const Referrer& referrer, const std::string& referrer_encoding, - content::WebContents* web_contents, + WebContents* web_contents, MessageLoop* on_completed_loop, const OnCompleted& on_completed) : on_completed_loop_(on_completed_loop), @@ -58,17 +57,16 @@ class DragDownloadFile::DragDownloadFileUI void InitiateDownload(scoped_ptr<net::FileStream> file_stream, const FilePath& file_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - content::DownloadManager* download_manager = + DownloadManager* download_manager = BrowserContext::GetDownloadManager(web_contents_->GetBrowserContext()); - scoped_ptr<content::DownloadSaveInfo> save_info( - new content::DownloadSaveInfo()); + scoped_ptr<DownloadSaveInfo> save_info(new DownloadSaveInfo()); save_info->file_path = file_path; save_info->file_stream.reset(file_stream.release()); RecordDownloadSource(INITIATED_BY_DRAG_N_DROP); - scoped_ptr<content::DownloadUrlParameters> params( - content::DownloadUrlParameters::FromWebContents( + scoped_ptr<DownloadUrlParameters> params( + DownloadUrlParameters::FromWebContents( web_contents_, url_, save_info.Pass())); params->set_referrer(referrer_); params->set_referrer_encoding(referrer_encoding_); @@ -95,7 +93,7 @@ class DragDownloadFile::DragDownloadFileUI download_item_->RemoveObserver(this); } - void OnDownloadStarted(content::DownloadItem* item, net::Error error) { + void OnDownloadStarted(DownloadItem* item, net::Error error) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); if (!item) { DCHECK_NE(net::OK, error); @@ -107,8 +105,8 @@ class DragDownloadFile::DragDownloadFileUI download_item_->AddObserver(this); } - // content::DownloadItem::Observer - virtual void OnDownloadUpdated(content::DownloadItem* item) OVERRIDE { + // DownloadItem::Observer: + virtual void OnDownloadUpdated(DownloadItem* item) OVERRIDE { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_EQ(download_item_, item); if (download_item_->IsComplete() || @@ -125,7 +123,7 @@ class DragDownloadFile::DragDownloadFileUI // Ignore other states. } - virtual void OnDownloadDestroyed(content::DownloadItem* item) OVERRIDE { + virtual void OnDownloadDestroyed(DownloadItem* item) OVERRIDE { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_EQ(download_item_, item); if (!on_completed_.is_null()) { @@ -140,10 +138,10 @@ class DragDownloadFile::DragDownloadFileUI MessageLoop* on_completed_loop_; OnCompleted on_completed_; GURL url_; - content::Referrer referrer_; + Referrer referrer_; std::string referrer_encoding_; - content::WebContents* web_contents_; - content::DownloadItem* download_item_; + WebContents* web_contents_; + DownloadItem* download_item_; // Only used in the callback from DownloadManager::DownloadUrl(). base::WeakPtrFactory<DragDownloadFileUI> weak_ptr_factory_; @@ -151,13 +149,12 @@ class DragDownloadFile::DragDownloadFileUI DISALLOW_COPY_AND_ASSIGN(DragDownloadFileUI); }; -DragDownloadFile::DragDownloadFile( - const FilePath& file_path, - scoped_ptr<net::FileStream> file_stream, - const GURL& url, - const content::Referrer& referrer, - const std::string& referrer_encoding, - WebContents* web_contents) +DragDownloadFile::DragDownloadFile(const FilePath& file_path, + scoped_ptr<net::FileStream> file_stream, + const GURL& url, + const Referrer& referrer, + const std::string& referrer_encoding, + WebContents* web_contents) : file_path_(file_path), file_stream_(file_stream.Pass()), drag_message_loop_(MessageLoop::current()), diff --git a/content/browser/download/drag_download_file_browsertest.cc b/content/browser/download/drag_download_file_browsertest.cc index ce844af..948b3ba 100644 --- a/content/browser/download/drag_download_file_browsertest.cc +++ b/content/browser/download/drag_download_file_browsertest.cc @@ -94,7 +94,7 @@ IN_PROC_BROWSER_TEST_F(DragDownloadFileTest, DragDownloadFileTest_NetError) { "DragDownloadFileTest_NetError.txt")); GURL url(URLRequestMockHTTPJob::GetMockUrl(FilePath(FILE_PATH_LITERAL( "download-test.lib")))); - content::Referrer referrer; + Referrer referrer; std::string referrer_encoding; DragDownloadFile* file = new DragDownloadFile( name, scoped_ptr<net::FileStream>(NULL), url, referrer, @@ -114,7 +114,7 @@ IN_PROC_BROWSER_TEST_F(DragDownloadFileTest, DragDownloadFileTest_Complete) { "DragDownloadFileTest_Complete.txt")); GURL url(URLRequestMockHTTPJob::GetMockUrl(FilePath(FILE_PATH_LITERAL( "download-test.lib")))); - content::Referrer referrer; + Referrer referrer; std::string referrer_encoding; net::FileStream* stream = NULL; #if defined(OS_POSIX) diff --git a/content/browser/gamepad/gamepad_platform_data_fetcher_linux.cc b/content/browser/gamepad/gamepad_platform_data_fetcher_linux.cc index 0342917..fb340b4 100644 --- a/content/browser/gamepad/gamepad_platform_data_fetcher_linux.cc +++ b/content/browser/gamepad/gamepad_platform_data_fetcher_linux.cc @@ -73,8 +73,7 @@ GamepadPlatformDataFetcherLinux::GamepadPlatformDataFetcherLinux() { memset(mappers_, 0, sizeof(mappers_)); std::vector<UdevLinux::UdevMonitorFilter> filters; - filters.push_back( - content::UdevLinux::UdevMonitorFilter(kInputSubsystem, NULL)); + filters.push_back(UdevLinux::UdevMonitorFilter(kInputSubsystem, NULL)); udev_.reset( new UdevLinux(filters, base::Bind(&GamepadPlatformDataFetcherLinux::RefreshDevice, diff --git a/content/browser/gpu/compositor_util.cc b/content/browser/gpu/compositor_util.cc index 878aaa3..d954590 100644 --- a/content/browser/gpu/compositor_util.cc +++ b/content/browser/gpu/compositor_util.cc @@ -10,19 +10,19 @@ #include "content/public/common/content_constants.h" #include "content/public/common/content_switches.h" -namespace { +namespace content { -using content::GpuDataManager; +namespace { bool CanDoAcceleratedCompositing() { const GpuDataManager* gpu_data_manager = GpuDataManager::GetInstance(); - content::GpuFeatureType blacklisted_features = + GpuFeatureType blacklisted_features = gpu_data_manager->GetBlacklistedFeatures(); // Don't run the field trial if gpu access has been blocked or // accelerated compositing is blacklisted. if (!gpu_data_manager->GpuAccessAllowed() || - blacklisted_features & content::GPU_FEATURE_TYPE_ACCELERATED_COMPOSITING) + blacklisted_features & GPU_FEATURE_TYPE_ACCELERATED_COMPOSITING) return false; // Check for the software rasterizer (SwiftShader). @@ -38,8 +38,6 @@ bool CanDoAcceleratedCompositing() { } // namespace -namespace content { - bool IsThreadedCompositingEnabled() { #if defined(OS_WIN) && defined(USE_AURA) // We always want compositing on Aura Windows. @@ -60,10 +58,9 @@ bool IsThreadedCompositingEnabled() { return true; base::FieldTrial* trial = - base::FieldTrialList::Find(content::kGpuCompositingFieldTrialName); + base::FieldTrialList::Find(kGpuCompositingFieldTrialName); return trial && - trial->group_name() == - content::kGpuCompositingFieldTrialThreadEnabledName; + trial->group_name() == kGpuCompositingFieldTrialThreadEnabledName; } bool IsForceCompositingModeEnabled() { @@ -85,15 +82,14 @@ bool IsForceCompositingModeEnabled() { return true; base::FieldTrial* trial = - base::FieldTrialList::Find(content::kGpuCompositingFieldTrialName); + base::FieldTrialList::Find(kGpuCompositingFieldTrialName); // Force compositing is enabled in both the force compositing // and threaded compositing mode field trials. return trial && (trial->group_name() == - content::kGpuCompositingFieldTrialForceCompositingEnabledName || - trial->group_name() == - content::kGpuCompositingFieldTrialThreadEnabledName); + kGpuCompositingFieldTrialForceCompositingEnabledName || + trial->group_name() == kGpuCompositingFieldTrialThreadEnabledName); } } // namespace content diff --git a/content/browser/hyphenator/hyphenator_message_filter.cc b/content/browser/hyphenator/hyphenator_message_filter.cc index 2132f76..3547490 100644 --- a/content/browser/hyphenator/hyphenator_message_filter.cc +++ b/content/browser/hyphenator/hyphenator_message_filter.cc @@ -13,22 +13,22 @@ #include "content/public/browser/content_browser_client.h" #include "content/public/browser/render_process_host.h" +namespace content { + namespace { // A helper function that closes the specified file in the FILE thread. This // function may be called after the HyphenatorMessageFilter object that owns the // specified file is deleted, i.e. this function must not depend on the object. void CloseDictionary(base::PlatformFile file) { - DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE)); + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); base::ClosePlatformFile(file); } } // namespace -namespace content { - HyphenatorMessageFilter::HyphenatorMessageFilter( - content::RenderProcessHost* render_process_host) + RenderProcessHost* render_process_host) : render_process_host_(render_process_host), dictionary_file_(base::kInvalidPlatformFileValue), weak_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { @@ -38,7 +38,7 @@ HyphenatorMessageFilter::~HyphenatorMessageFilter() { // Post a FILE task that deletes the dictionary file. This message filter is // usually deleted on the IO thread, which does not allow file operations. if (dictionary_file_ != base::kInvalidPlatformFileValue) { - content::BrowserThread::PostTask( + BrowserThread::PostTask( BrowserThread::FILE, FROM_HERE, base::Bind(&CloseDictionary, dictionary_file_)); @@ -74,8 +74,8 @@ void HyphenatorMessageFilter::OnOpenDictionary(const string16& locale) { SendDictionary(); return; } - content::BrowserThread::PostTaskAndReply( - content::BrowserThread::FILE, + BrowserThread::PostTaskAndReply( + BrowserThread::FILE, FROM_HERE, base::Bind(&HyphenatorMessageFilter::OpenDictionary, this, locale), base::Bind(&HyphenatorMessageFilter::SendDictionary, diff --git a/content/browser/hyphenator/hyphenator_message_filter_unittest.cc b/content/browser/hyphenator/hyphenator_message_filter_unittest.cc index eff459e..2c047b8 100644 --- a/content/browser/hyphenator/hyphenator_message_filter_unittest.cc +++ b/content/browser/hyphenator/hyphenator_message_filter_unittest.cc @@ -21,10 +21,10 @@ namespace content { // A class derived from the HyphenatorMessageFilter class used in unit tests. // This class overrides some methods so we can test the HyphenatorMessageFilter // class without posting tasks. -class TestHyphenatorMessageFilter : public content::HyphenatorMessageFilter { +class TestHyphenatorMessageFilter : public HyphenatorMessageFilter { public: - explicit TestHyphenatorMessageFilter(content::RenderProcessHost* host) - : content::HyphenatorMessageFilter(host), + explicit TestHyphenatorMessageFilter(RenderProcessHost* host) + : HyphenatorMessageFilter(host), type_(0), file_(base::kInvalidPlatformFileValue) { } @@ -33,7 +33,7 @@ class TestHyphenatorMessageFilter : public content::HyphenatorMessageFilter { uint32 type() const { return type_; } base::PlatformFile file() const { return file_; } - // content::BrowserMessageFilter implementation. + // BrowserMessageFilter implementation. virtual bool Send(IPC::Message* message) OVERRIDE { if (message->type() != HyphenatorMsg_SetDictionary::ID) return false; @@ -71,7 +71,7 @@ class TestHyphenatorMessageFilter : public content::HyphenatorMessageFilter { virtual ~TestHyphenatorMessageFilter() { } - // content::HyphenatorMessageFilter implementation. This function emulates the + // HyphenatorMessageFilter implementation. This function emulates the // original implementation without posting a task. virtual void OnOpenDictionary(const string16& locale) OVERRIDE { locale_ = locale; @@ -85,21 +85,19 @@ class TestHyphenatorMessageFilter : public content::HyphenatorMessageFilter { base::PlatformFile file_; }; -} // namespace content - class HyphenatorMessageFilterTest : public testing::Test { public: HyphenatorMessageFilterTest() { - context_.reset(new content::TestBrowserContext); - host_.reset(new content::MockRenderProcessHost(context_.get())); - filter_ = new content::TestHyphenatorMessageFilter(host_.get()); + context_.reset(new TestBrowserContext); + host_.reset(new MockRenderProcessHost(context_.get())); + filter_ = new TestHyphenatorMessageFilter(host_.get()); } virtual ~HyphenatorMessageFilterTest() {} - scoped_ptr<content::TestBrowserContext> context_; - scoped_ptr<content::MockRenderProcessHost> host_; - scoped_refptr<content::TestHyphenatorMessageFilter> filter_; + scoped_ptr<TestBrowserContext> context_; + scoped_ptr<MockRenderProcessHost> host_; + scoped_refptr<TestHyphenatorMessageFilter> filter_; }; // Verifies IPC messages sent by the HyphenatorMessageFilter class when it @@ -153,3 +151,5 @@ TEST_F(HyphenatorMessageFilterTest, OpenDictionary) { if (file != base::kInvalidPlatformFileValue) base::ClosePlatformFile(file); } + +} // namespace content |