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

Side by Side Diff: chrome/browser/extensions/api/downloads/downloads_api.cc

Issue 2688413007: Add display::GetDisplayNearestView (Closed)
Patch Set: add missing files Created 3 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
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/extensions/api/downloads/downloads_api.h" 5 #include "chrome/browser/extensions/api/downloads/downloads_api.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <memory> 9 #include <memory>
10 #include <set> 10 #include <set>
(...skipping 1489 matching lines...) Expand 10 before | Expand all | Expand 10 after
1500 return false; 1500 return false;
1501 // In-progress downloads return the intermediate filename for GetFullPath() 1501 // In-progress downloads return the intermediate filename for GetFullPath()
1502 // which doesn't have the final extension. Therefore a good file icon can't be 1502 // which doesn't have the final extension. Therefore a good file icon can't be
1503 // found, so use GetTargetFilePath() instead. 1503 // found, so use GetTargetFilePath() instead.
1504 DCHECK(icon_extractor_.get()); 1504 DCHECK(icon_extractor_.get());
1505 DCHECK(icon_size == 16 || icon_size == 32); 1505 DCHECK(icon_size == 16 || icon_size == 32);
1506 float scale = 1.0; 1506 float scale = 1.0;
1507 content::WebContents* web_contents = 1507 content::WebContents* web_contents =
1508 dispatcher()->GetVisibleWebContents(); 1508 dispatcher()->GetVisibleWebContents();
1509 if (web_contents) { 1509 if (web_contents) {
1510 scale = ui::GetScaleFactorForNativeView( 1510 scale =
1511 web_contents->GetRenderWidgetHostView()->GetNativeView()); 1511 web_contents->GetRenderWidgetHostView()->GetScaleFactorForNativeView();
1512 } 1512 }
1513 EXTENSION_FUNCTION_VALIDATE(icon_extractor_->ExtractIconURLForPath( 1513 EXTENSION_FUNCTION_VALIDATE(icon_extractor_->ExtractIconURLForPath(
1514 download_item->GetTargetFilePath(), 1514 download_item->GetTargetFilePath(),
1515 scale, 1515 scale,
1516 IconLoaderSizeFromPixelSize(icon_size), 1516 IconLoaderSizeFromPixelSize(icon_size),
1517 base::Bind(&DownloadsGetFileIconFunction::OnIconURLExtracted, this))); 1517 base::Bind(&DownloadsGetFileIconFunction::OnIconURLExtracted, this)));
1518 return true; 1518 return true;
1519 } 1519 }
1520 1520
1521 void DownloadsGetFileIconFunction::OnIconURLExtracted(const std::string& url) { 1521 void DownloadsGetFileIconFunction::OnIconURLExtracted(const std::string& url) {
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
1921 return; 1921 return;
1922 base::Time now(base::Time::Now()); 1922 base::Time now(base::Time::Now());
1923 int delta = now.ToTimeT() - last_checked_removal_.ToTimeT(); 1923 int delta = now.ToTimeT() - last_checked_removal_.ToTimeT();
1924 if (delta <= kFileExistenceRateLimitSeconds) 1924 if (delta <= kFileExistenceRateLimitSeconds)
1925 return; 1925 return;
1926 last_checked_removal_ = now; 1926 last_checked_removal_ = now;
1927 manager->CheckForHistoryFilesRemoval(); 1927 manager->CheckForHistoryFilesRemoval();
1928 } 1928 }
1929 1929
1930 } // namespace extensions 1930 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698