OLD | NEW |
1 // Copyright (c) 2013 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/notifications/message_center_settings_controller.h" | 5 #include "chrome/browser/notifications/message_center_settings_controller.h" |
6 | 6 |
7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
8 #include "chrome/browser/extensions/app_icon_loader_impl.h" | 8 #include "chrome/browser/extensions/app_icon_loader_impl.h" |
9 #include "chrome/browser/extensions/extension_service.h" | 9 #include "chrome/browser/extensions/extension_service.h" |
10 #include "chrome/browser/favicon/favicon_service.h" | 10 #include "chrome/browser/favicon/favicon_service.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 DesktopNotificationService* notification_service = | 48 DesktopNotificationService* notification_service = |
49 DesktopNotificationServiceFactory::GetForProfile(profile); | 49 DesktopNotificationServiceFactory::GetForProfile(profile); |
50 | 50 |
51 ExtensionService* extension_service = profile->GetExtensionService(); | 51 ExtensionService* extension_service = profile->GetExtensionService(); |
52 const ExtensionSet* extension_set = extension_service->extensions(); | 52 const ExtensionSet* extension_set = extension_service->extensions(); |
53 app_icon_loader_.reset(new extensions::AppIconLoaderImpl( | 53 app_icon_loader_.reset(new extensions::AppIconLoaderImpl( |
54 profile, message_center::kSettingsIconSize, this)); | 54 profile, message_center::kSettingsIconSize, this)); |
55 for (ExtensionSet::const_iterator iter = extension_set->begin(); | 55 for (ExtensionSet::const_iterator iter = extension_set->begin(); |
56 iter != extension_set->end(); ++iter) { | 56 iter != extension_set->end(); ++iter) { |
57 const extensions::Extension* extension = *iter; | 57 const extensions::Extension* extension = *iter; |
58 // Currently, our notification API is provided for experimental apps. | 58 if (!extension->HasAPIPermission( |
59 // TODO(mukai, miket): determine the actual rule and fix here. | 59 extensions::APIPermission::kNotification)) { |
60 if (!extension->is_app() || !extension->HasAPIPermission( | |
61 extensions::APIPermission::kExperimental)) { | |
62 continue; | 60 continue; |
63 } | 61 } |
64 | 62 |
65 notifiers->push_back(new message_center::Notifier( | 63 notifiers->push_back(new message_center::Notifier( |
66 extension->id(), | 64 extension->id(), |
67 UTF8ToUTF16(extension->name()), | 65 UTF8ToUTF16(extension->name()), |
68 notification_service->IsExtensionEnabled(extension->id()))); | 66 notification_service->IsExtensionEnabled(extension->id()))); |
69 app_icon_loader_->FetchImage(extension->id()); | 67 app_icon_loader_->FetchImage(extension->id()); |
70 } | 68 } |
71 | 69 |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 settings_view_->UpdateFavicon(url, favicon_result.image); | 155 settings_view_->UpdateFavicon(url, favicon_result.image); |
158 } | 156 } |
159 | 157 |
160 | 158 |
161 void MessageCenterSettingsController::SetAppImage(const std::string& id, | 159 void MessageCenterSettingsController::SetAppImage(const std::string& id, |
162 const gfx::ImageSkia& image) { | 160 const gfx::ImageSkia& image) { |
163 if (!settings_view_) | 161 if (!settings_view_) |
164 return; | 162 return; |
165 settings_view_->UpdateIconImage(id, image); | 163 settings_view_->UpdateIconImage(id, image); |
166 } | 164 } |
OLD | NEW |