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

Side by Side Diff: chrome/browser/ui/gtk/create_application_shortcuts_dialog_gtk.cc

Issue 11786003: Move Icons out of Extension class (Closed) Base URL: http://git.chromium.org/chromium/src.git@dc_unref_browser_action
Patch Set: License year update Created 7 years, 11 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) 2013 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/ui/gtk/create_application_shortcuts_dialog_gtk.h" 5 #include "chrome/browser/ui/gtk/create_application_shortcuts_dialog_gtk.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/environment.h" 10 #include "base/environment.h"
11 #include "base/utf_string_conversions.h" 11 #include "base/utf_string_conversions.h"
12 #include "chrome/browser/profiles/profile.h" 12 #include "chrome/browser/profiles/profile.h"
13 #include "chrome/browser/shell_integration.h" 13 #include "chrome/browser/shell_integration.h"
14 #include "chrome/browser/shell_integration_linux.h" 14 #include "chrome/browser/shell_integration_linux.h"
15 #include "chrome/browser/ui/browser.h" 15 #include "chrome/browser/ui/browser.h"
16 #include "chrome/browser/ui/browser_commands.h" 16 #include "chrome/browser/ui/browser_commands.h"
17 #include "chrome/browser/ui/browser_dialogs.h" 17 #include "chrome/browser/ui/browser_dialogs.h"
18 #include "chrome/browser/ui/browser_finder.h" 18 #include "chrome/browser/ui/browser_finder.h"
19 #include "chrome/browser/ui/gtk/gtk_util.h" 19 #include "chrome/browser/ui/gtk/gtk_util.h"
20 #include "chrome/browser/ui/web_applications/web_app_ui.h" 20 #include "chrome/browser/ui/web_applications/web_app_ui.h"
21 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" 21 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h"
22 #include "chrome/browser/web_applications/web_app.h" 22 #include "chrome/browser/web_applications/web_app.h"
23 #include "chrome/common/extensions/api/icons/icons_handler.h"
23 #include "chrome/common/extensions/extension.h" 24 #include "chrome/common/extensions/extension.h"
24 #include "chrome/common/extensions/extension_resource.h" 25 #include "chrome/common/extensions/extension_resource.h"
25 #include "content/public/browser/browser_thread.h" 26 #include "content/public/browser/browser_thread.h"
26 #include "content/public/browser/web_contents.h" 27 #include "content/public/browser/web_contents.h"
27 #include "content/public/browser/web_contents_delegate.h" 28 #include "content/public/browser/web_contents_delegate.h"
28 #include "grit/chromium_strings.h" 29 #include "grit/chromium_strings.h"
29 #include "grit/generated_resources.h" 30 #include "grit/generated_resources.h"
30 #include "grit/locale_settings.h" 31 #include "grit/locale_settings.h"
31 #include "grit/theme_resources.h" 32 #include "grit/theme_resources.h"
32 #include "ui/base/gtk/gtk_hig_constants.h" 33 #include "ui/base/gtk/gtk_hig_constants.h"
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 : CreateApplicationShortcutsDialogGtk(parent), 318 : CreateApplicationShortcutsDialogGtk(parent),
318 app_(app), 319 app_(app),
319 profile_path_(profile->GetPath()), 320 profile_path_(profile->GetPath()),
320 ALLOW_THIS_IN_INITIALIZER_LIST(tracker_(this)) { 321 ALLOW_THIS_IN_INITIALIZER_LIST(tracker_(this)) {
321 322
322 // Get shortcut information now, it's needed for our UI. 323 // Get shortcut information now, it's needed for our UI.
323 web_app::UpdateShortcutInfoForApp(*app, profile, &shortcut_info_); 324 web_app::UpdateShortcutInfoForApp(*app, profile, &shortcut_info_);
324 325
325 // Get the icon. 326 // Get the icon.
326 const gfx::Size max_size(kIconPreviewSizePixels, kIconPreviewSizePixels); 327 const gfx::Size max_size(kIconPreviewSizePixels, kIconPreviewSizePixels);
327 ExtensionResource icon_resource = app_->GetIconResource( 328 ExtensionResource icon_resource = extensions::IconsInfo::GetIconResource(
328 kIconPreviewSizePixels, ExtensionIconSet::MATCH_BIGGER); 329 app_, kIconPreviewSizePixels, ExtensionIconSet::MATCH_BIGGER);
329 330
330 // If no icon exists that is the desired size or larger, get the 331 // If no icon exists that is the desired size or larger, get the
331 // largest icon available: 332 // largest icon available:
332 if (icon_resource.empty()) 333 if (icon_resource.empty())
333 icon_resource = app_->GetIconResource( 334 icon_resource = extensions::IconsInfo::GetIconResource(
334 kIconPreviewSizePixels, ExtensionIconSet::MATCH_SMALLER); 335 app_, kIconPreviewSizePixels, ExtensionIconSet::MATCH_SMALLER);
335 336
336 // Note that tracker_.LoadImage() can call OnImageLoaded() before it returns, 337 // Note that tracker_.LoadImage() can call OnImageLoaded() before it returns,
337 // if the image is cached. This is very rare. Do not do anything after 338 // if the image is cached. This is very rare. Do not do anything after
338 // calling LoadImage() that OnImageLoaded() depends on. 339 // calling LoadImage() that OnImageLoaded() depends on.
339 tracker_.LoadImage(app_, 340 tracker_.LoadImage(app_,
340 icon_resource, 341 icon_resource,
341 max_size, 342 max_size,
342 ImageLoadingTracker::DONT_CACHE); 343 ImageLoadingTracker::DONT_CACHE);
343 } 344 }
344 345
(...skipping 18 matching lines...) Expand all
363 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 364 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
364 365
365 if (web_app::CreateShortcutsOnFileThread(shortcut_info)) { 366 if (web_app::CreateShortcutsOnFileThread(shortcut_info)) {
366 Release(); 367 Release();
367 } else { 368 } else {
368 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, 369 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
369 base::Bind(&CreateChromeApplicationShortcutsDialogGtk::ShowErrorDialog, 370 base::Bind(&CreateChromeApplicationShortcutsDialogGtk::ShowErrorDialog,
370 this)); 371 this));
371 } 372 }
372 } 373 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698