Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / extensions / browser / extension_protocols.cc
index 71cefcc..87a9e0e 100644 (file)
@@ -59,6 +59,7 @@
 
 using content::BrowserThread;
 using content::ResourceRequestInfo;
+using content::ResourceType;
 using extensions::Extension;
 using extensions::SharedModuleInfo;
 
@@ -195,6 +196,7 @@ class URLRequestExtensionJob : public net::URLRequestFileJob {
   }
 
   virtual void Start() OVERRIDE {
+    request_timer_.reset(new base::ElapsedTimer());
     base::FilePath* read_file_path = new base::FilePath;
     base::Time* last_modified_time = new base::Time();
     bool posted = BrowserThread::PostBlockingPoolTaskAndReply(
@@ -252,6 +254,9 @@ class URLRequestExtensionJob : public net::URLRequestFileJob {
   virtual ~URLRequestExtensionJob() {
     UMA_HISTOGRAM_COUNTS("ExtensionUrlRequest.TotalKbRead", bytes_read_ / 1024);
     UMA_HISTOGRAM_COUNTS("ExtensionUrlRequest.SeekPosition", seek_position_);
+    if (request_timer_.get())
+      UMA_HISTOGRAM_TIMES("ExtensionUrlRequest.Latency",
+                          request_timer_->Elapsed());
   }
 
   void OnFilePathAndLastModifiedTimeRead(base::FilePath* read_file_path,
@@ -266,6 +271,8 @@ class URLRequestExtensionJob : public net::URLRequestFileJob {
 
   scoped_refptr<ContentVerifyJob> verify_job_;
 
+  scoped_ptr<base::ElapsedTimer> request_timer_;
+
   // The position we seeked to in the file.
   int64 seek_position_;
 
@@ -289,7 +296,7 @@ bool ExtensionCanLoadInIncognito(const ResourceRequestInfo* info,
   // Only allow incognito toplevel navigations to extension resources in
   // split mode. In spanning mode, the extension must run in a single process,
   // and an incognito tab prevents that.
-  if (info->GetResourceType() == ResourceType::MAIN_FRAME) {
+  if (info->GetResourceType() == content::RESOURCE_TYPE_MAIN_FRAME) {
     const Extension* extension =
         extension_info_map->extensions().GetByID(extension_id);
     return extension && extensions::IncognitoInfo::IsSplitMode(extension);