Update icon loading API implementation
This commit is contained in:
parent
19b686c90b
commit
977abc6458
9 changed files with 176 additions and 243 deletions
|
@ -890,15 +890,18 @@ void App::GetFileIcon(const base::FilePath& path,
|
|||
return;
|
||||
}
|
||||
|
||||
IconManager* icon_manager = IconManager::GetInstance();
|
||||
gfx::Image* icon = icon_manager->LookupIconFromFilepath(normalized_path,
|
||||
if (!icon_manager_.get()) {
|
||||
icon_manager_.reset(new IconManager());
|
||||
}
|
||||
|
||||
gfx::Image* icon = icon_manager_->LookupIconFromFilepath(normalized_path,
|
||||
icon_size);
|
||||
if (icon) {
|
||||
callback.Run(v8::Null(isolate()), *icon);
|
||||
} else {
|
||||
icon_manager->LoadIcon(normalized_path, icon_size,
|
||||
icon_manager_->LoadIcon(normalized_path, icon_size,
|
||||
base::Bind(&OnIconDataAvailable, isolate(),
|
||||
callback));
|
||||
callback), &cancelable_task_tracker_);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,8 @@
|
|||
#include "atom/browser/browser.h"
|
||||
#include "atom/browser/browser_observer.h"
|
||||
#include "atom/common/native_mate_converters/callback.h"
|
||||
#include "chrome/browser/icon_loader.h"
|
||||
#include "base/task/cancelable_task_tracker.h"
|
||||
#include "chrome/browser/icon_manager.h"
|
||||
#include "chrome/browser/process_singleton.h"
|
||||
#include "content/public/browser/gpu_data_manager_observer.h"
|
||||
#include "native_mate/handle.h"
|
||||
|
@ -129,6 +130,8 @@ class App : public AtomBrowserClient::Delegate,
|
|||
void DisableHardwareAcceleration(mate::Arguments* args);
|
||||
bool IsAccessibilitySupportEnabled();
|
||||
Browser::LoginItemSettings GetLoginItemSettings(mate::Arguments* args);
|
||||
base::CancelableTaskTracker cancelable_task_tracker_;
|
||||
std::unique_ptr<IconManager> icon_manager_;
|
||||
#if defined(USE_NSS_CERTS)
|
||||
void ImportCertificate(const base::DictionaryValue& options,
|
||||
const net::CompletionCallback& callback);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue