Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(57)

Side by Side Diff: chrome/browser/plugin_installer.cc

Issue 9316116: Isolate initiation counts for downloads to their own histograms and improve (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Restored curlies to original. Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/plugin_installer.h" 5 #include "chrome/browser/plugin_installer.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/process.h" 10 #include "base/process.h"
11 #include "chrome/browser/download/download_service_factory.h" 11 #include "chrome/browser/download/download_service_factory.h"
12 #include "chrome/browser/download/download_service.h" 12 #include "chrome/browser/download/download_service.h"
13 #include "chrome/browser/download/download_util.h"
13 #include "chrome/browser/platform_util.h" 14 #include "chrome/browser/platform_util.h"
14 #include "chrome/browser/plugin_installer_observer.h" 15 #include "chrome/browser/plugin_installer_observer.h"
15 #include "chrome/browser/profiles/profile.h" 16 #include "chrome/browser/profiles/profile.h"
16 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 17 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
17 #include "content/browser/download/download_types.h" 18 #include "content/browser/download/download_types.h"
18 #include "content/browser/renderer_host/render_view_host.h" 19 #include "content/browser/renderer_host/render_view_host.h"
19 #include "content/browser/renderer_host/resource_dispatcher_host.h" 20 #include "content/browser/renderer_host/resource_dispatcher_host.h"
20 #include "content/public/browser/download_id.h" 21 #include "content/public/browser/download_id.h"
21 #include "content/public/browser/download_manager.h" 22 #include "content/public/browser/download_manager.h"
22 #include "content/public/browser/browser_context.h" 23 #include "content/public/browser/browser_context.h"
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 } 133 }
133 134
134 void PluginInstaller::StartInstalling(TabContentsWrapper* wrapper) { 135 void PluginInstaller::StartInstalling(TabContentsWrapper* wrapper) {
135 DCHECK(state_ == kStateIdle); 136 DCHECK(state_ == kStateIdle);
136 DCHECK(!url_for_display_); 137 DCHECK(!url_for_display_);
137 state_ = kStateDownloading; 138 state_ = kStateDownloading;
138 FOR_EACH_OBSERVER(PluginInstallerObserver, observers_, DownloadStarted()); 139 FOR_EACH_OBSERVER(PluginInstallerObserver, observers_, DownloadStarted());
139 content::WebContents* web_contents = wrapper->web_contents(); 140 content::WebContents* web_contents = wrapper->web_contents();
140 DownloadService* download_service = 141 DownloadService* download_service =
141 DownloadServiceFactory::GetForProfile(wrapper->profile()); 142 DownloadServiceFactory::GetForProfile(wrapper->profile());
143 download_util::RecordDownloadSource(
144 download_util::INITIATED_BY_PLUGIN_INSTALLER);
142 BrowserThread::PostTask( 145 BrowserThread::PostTask(
143 BrowserThread::IO, FROM_HERE, 146 BrowserThread::IO, FROM_HERE,
144 base::Bind(&BeginDownload, 147 base::Bind(&BeginDownload,
145 plugin_url_, ResourceDispatcherHost::Get(), 148 plugin_url_, ResourceDispatcherHost::Get(),
146 wrapper->profile()->GetResourceContext(), 149 wrapper->profile()->GetResourceContext(),
147 web_contents->GetRenderProcessHost()->GetID(), 150 web_contents->GetRenderProcessHost()->GetID(),
148 web_contents->GetRenderViewHost()->routing_id(), 151 web_contents->GetRenderViewHost()->routing_id(),
149 base::Bind(&PluginInstaller::DownloadStarted, 152 base::Bind(&PluginInstaller::DownloadStarted,
150 base::Unretained(this), 153 base::Unretained(this),
151 make_scoped_refptr( 154 make_scoped_refptr(
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 DCHECK(state_ == kStateDownloading); 186 DCHECK(state_ == kStateDownloading);
184 state_ = kStateIdle; 187 state_ = kStateIdle;
185 FOR_EACH_OBSERVER(PluginInstallerObserver, observers_, DownloadError(msg)); 188 FOR_EACH_OBSERVER(PluginInstallerObserver, observers_, DownloadError(msg));
186 } 189 }
187 190
188 void PluginInstaller::DownloadCancelled() { 191 void PluginInstaller::DownloadCancelled() {
189 DCHECK(state_ == kStateDownloading); 192 DCHECK(state_ == kStateDownloading);
190 state_ = kStateIdle; 193 state_ = kStateIdle;
191 FOR_EACH_OBSERVER(PluginInstallerObserver, observers_, DownloadCancelled()); 194 FOR_EACH_OBSERVER(PluginInstallerObserver, observers_, DownloadCancelled());
192 } 195 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698