OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/views/aura/app_list/extension_app_item.h" | 5 #include "chrome/browser/ui/views/aura/app_list/extension_app_item.h" |
6 | 6 |
7 #include "ash/app_list/app_list_item_view.h" | 7 #include "ash/app_list/app_list_item_view.h" |
8 #include "chrome/browser/event_disposition.h" | 8 #include "chrome/browser/event_disposition.h" |
9 #include "chrome/browser/extensions/extension_prefs.h" | 9 #include "chrome/browser/extensions/extension_prefs.h" |
10 #include "chrome/browser/extensions/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 } | 77 } |
78 | 78 |
79 const Extension* ExtensionAppItem::GetExtension() const { | 79 const Extension* ExtensionAppItem::GetExtension() const { |
80 const Extension* extension = | 80 const Extension* extension = |
81 profile_->GetExtensionService()->GetInstalledExtension(extension_id_); | 81 profile_->GetExtensionService()->GetInstalledExtension(extension_id_); |
82 return extension; | 82 return extension; |
83 } | 83 } |
84 | 84 |
85 void ExtensionAppItem::LoadImage(const Extension* extension) { | 85 void ExtensionAppItem::LoadImage(const Extension* extension) { |
86 ExtensionResource icon = extension->GetIconResource( | 86 ExtensionResource icon = extension->GetIconResource( |
87 aura_shell::AppListItemView::kIconSize, | 87 ash::AppListItemView::kIconSize, |
88 ExtensionIconSet::MATCH_BIGGER); | 88 ExtensionIconSet::MATCH_BIGGER); |
89 if (icon.relative_path().empty()) { | 89 if (icon.relative_path().empty()) { |
90 LoadDefaultImage(); | 90 LoadDefaultImage(); |
91 return; | 91 return; |
92 } | 92 } |
93 | 93 |
94 if (extension->location() == Extension::COMPONENT) { | 94 if (extension->location() == Extension::COMPONENT) { |
95 FilePath directory_path = extension->path(); | 95 FilePath directory_path = extension->path(); |
96 FilePath relative_path = directory_path.BaseName().Append( | 96 FilePath relative_path = directory_path.BaseName().Append( |
97 icon.relative_path()); | 97 icon.relative_path()); |
(...skipping 17 matching lines...) Expand all Loading... |
115 } else { | 115 } else { |
116 NOTREACHED() << "Unable to decode image resource " << resource; | 116 NOTREACHED() << "Unable to decode image resource " << resource; |
117 } | 117 } |
118 } | 118 } |
119 } | 119 } |
120 } | 120 } |
121 | 121 |
122 tracker_.reset(new ImageLoadingTracker(this)); | 122 tracker_.reset(new ImageLoadingTracker(this)); |
123 tracker_->LoadImage(extension, | 123 tracker_->LoadImage(extension, |
124 icon, | 124 icon, |
125 gfx::Size(aura_shell::AppListItemView::kIconSize, | 125 gfx::Size(ash::AppListItemView::kIconSize, |
126 aura_shell::AppListItemView::kIconSize), | 126 ash::AppListItemView::kIconSize), |
127 ImageLoadingTracker::DONT_CACHE); | 127 ImageLoadingTracker::DONT_CACHE); |
128 } | 128 } |
129 | 129 |
130 void ExtensionAppItem::LoadDefaultImage() { | 130 void ExtensionAppItem::LoadDefaultImage() { |
131 const Extension* extension = GetExtension(); | 131 const Extension* extension = GetExtension(); |
132 int resource = IDR_APP_DEFAULT_ICON; | 132 int resource = IDR_APP_DEFAULT_ICON; |
133 if (extension && extension->id() == extension_misc::kWebStoreAppId) | 133 if (extension && extension->id() == extension_misc::kWebStoreAppId) |
134 resource = IDR_WEBSTORE_ICON; | 134 resource = IDR_WEBSTORE_ICON; |
135 | 135 |
136 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 136 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 // is set, launch as a regular tab. | 172 // is set, launch as a regular tab. |
173 extension_misc::LaunchContainer launch_container = | 173 extension_misc::LaunchContainer launch_container = |
174 profile_->GetExtensionService()->extension_prefs()->GetLaunchContainer( | 174 profile_->GetExtensionService()->extension_prefs()->GetLaunchContainer( |
175 extension, ExtensionPrefs::LAUNCH_REGULAR); | 175 extension, ExtensionPrefs::LAUNCH_REGULAR); |
176 | 176 |
177 Browser::OpenApplication( | 177 Browser::OpenApplication( |
178 profile_, extension, launch_container, GURL(url), | 178 profile_, extension, launch_container, GURL(url), |
179 NEW_FOREGROUND_TAB); | 179 NEW_FOREGROUND_TAB); |
180 } | 180 } |
181 } | 181 } |
OLD | NEW |