| 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 <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/i18n/string_compare.h" | 10 #include "base/i18n/string_compare.h" |
| 11 #include "base/message_loop/message_loop_proxy.h" | 11 #include "base/message_loop/message_loop_proxy.h" |
| 12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
| 13 #include "base/task/cancelable_task_tracker.h" | 13 #include "base/task/cancelable_task_tracker.h" |
| 14 #include "chrome/browser/browser_process.h" | 14 #include "chrome/browser/browser_process.h" |
| 15 #include "chrome/browser/chrome_notification_types.h" | 15 #include "chrome/browser/chrome_notification_types.h" |
| 16 #include "chrome/browser/content_settings/host_content_settings_map.h" | 16 #include "chrome/browser/content_settings/host_content_settings_map.h" |
| 17 #include "chrome/browser/extensions/app_icon_loader_impl.h" | 17 #include "chrome/browser/extensions/app_icon_loader_impl.h" |
| 18 #include "chrome/browser/favicon/favicon_service.h" | 18 #include "chrome/browser/favicon/favicon_service.h" |
| 19 #include "chrome/browser/favicon/favicon_service_factory.h" | 19 #include "chrome/browser/favicon/favicon_service_factory.h" |
| 20 #include "chrome/browser/history/history_types.h" | 20 #include "chrome/browser/history/history_types.h" |
| 21 #include "chrome/browser/notifications/desktop_notification_profile_util.h" | 21 #include "chrome/browser/notifications/desktop_notification_profile_util.h" |
| 22 #include "chrome/browser/notifications/desktop_notification_service.h" | 22 #include "chrome/browser/notifications/desktop_notification_service.h" |
| 23 #include "chrome/browser/notifications/desktop_notification_service_factory.h" | 23 #include "chrome/browser/notifications/desktop_notification_service_factory.h" |
| 24 #include "chrome/browser/notifications/sync_notifier/chrome_notifier_service.h" | 24 #include "chrome/browser/notifications/sync_notifier/chrome_notifier_service.h" |
| 25 #include "chrome/browser/notifications/sync_notifier/chrome_notifier_service_fac
tory.h" | 25 #include "chrome/browser/notifications/sync_notifier/chrome_notifier_service_fac
tory.h" |
| 26 #include "chrome/browser/profiles/profile.h" | 26 #include "chrome/browser/profiles/profile.h" |
| 27 #include "chrome/browser/profiles/profile_info_cache.h" | 27 #include "chrome/browser/profiles/profile_info_cache.h" |
| 28 #include "chrome/browser/profiles/profile_manager.h" | 28 #include "chrome/browser/profiles/profile_manager.h" |
| 29 #include "chrome/common/chrome_content_settings_client.h" |
| 29 #include "chrome/common/extensions/api/notifications.h" | 30 #include "chrome/common/extensions/api/notifications.h" |
| 30 #include "chrome/common/extensions/extension_constants.h" | 31 #include "chrome/common/extensions/extension_constants.h" |
| 31 #include "components/favicon_base/favicon_types.h" | 32 #include "components/favicon_base/favicon_types.h" |
| 32 #include "content/public/browser/notification_service.h" | 33 #include "content/public/browser/notification_service.h" |
| 33 #include "content/public/browser/notification_source.h" | 34 #include "content/public/browser/notification_source.h" |
| 34 #include "extensions/browser/event_router.h" | 35 #include "extensions/browser/event_router.h" |
| 35 #include "extensions/browser/extension_registry.h" | 36 #include "extensions/browser/extension_registry.h" |
| 36 #include "extensions/common/constants.h" | 37 #include "extensions/common/constants.h" |
| 37 #include "extensions/common/extension.h" | 38 #include "extensions/common/extension.h" |
| 38 #include "extensions/common/permissions/permissions_data.h" | 39 #include "extensions/common/permissions/permissions_data.h" |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 favicon_tracker_.reset(new base::CancelableTaskTracker()); | 251 favicon_tracker_.reset(new base::CancelableTaskTracker()); |
| 251 patterns_.clear(); | 252 patterns_.clear(); |
| 252 for (ContentSettingsForOneType::const_iterator iter = settings.begin(); | 253 for (ContentSettingsForOneType::const_iterator iter = settings.begin(); |
| 253 iter != settings.end(); ++iter) { | 254 iter != settings.end(); ++iter) { |
| 254 if (iter->primary_pattern == ContentSettingsPattern::Wildcard() && | 255 if (iter->primary_pattern == ContentSettingsPattern::Wildcard() && |
| 255 iter->secondary_pattern == ContentSettingsPattern::Wildcard() && | 256 iter->secondary_pattern == ContentSettingsPattern::Wildcard() && |
| 256 iter->source != "preference") { | 257 iter->source != "preference") { |
| 257 continue; | 258 continue; |
| 258 } | 259 } |
| 259 | 260 |
| 260 std::string url_pattern = iter->primary_pattern.ToString(); | 261 content_settings::ChromeContentSettingsClient client; |
| 262 std::string url_pattern = iter->primary_pattern.ToString(&client); |
| 261 base::string16 name = base::UTF8ToUTF16(url_pattern); | 263 base::string16 name = base::UTF8ToUTF16(url_pattern); |
| 262 GURL url(url_pattern); | 264 GURL url(url_pattern); |
| 263 NotifierId notifier_id(url); | 265 NotifierId notifier_id(url); |
| 264 notifiers->push_back(new Notifier( | 266 notifiers->push_back(new Notifier( |
| 265 notifier_id, | 267 notifier_id, |
| 266 name, | 268 name, |
| 267 notification_service->IsNotifierEnabled(notifier_id))); | 269 notification_service->IsNotifierEnabled(notifier_id))); |
| 268 patterns_[name] = iter->primary_pattern; | 270 patterns_[name] = iter->primary_pattern; |
| 269 // Note that favicon service obtains the favicon from history. This means | 271 // Note that favicon service obtains the favicon from history. This means |
| 270 // that it will fail to obtain the image if there are no history data for | 272 // that it will fail to obtain the image if there are no history data for |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 517 // another creating a primary profile, and causes an infinite loop. | 519 // another creating a primary profile, and causes an infinite loop. |
| 518 // Thus, it would be better to delay creating group for guest login. | 520 // Thus, it would be better to delay creating group for guest login. |
| 519 base::MessageLoopProxy::current()->PostTask( | 521 base::MessageLoopProxy::current()->PostTask( |
| 520 FROM_HERE, | 522 FROM_HERE, |
| 521 base::Bind( | 523 base::Bind( |
| 522 &MessageCenterSettingsController::CreateNotifierGroupForGuestLogin, | 524 &MessageCenterSettingsController::CreateNotifierGroupForGuestLogin, |
| 523 weak_factory_.GetWeakPtr())); | 525 weak_factory_.GetWeakPtr())); |
| 524 } | 526 } |
| 525 #endif | 527 #endif |
| 526 } | 528 } |
| OLD | NEW |