OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/extensions/api/notifications/notifications_api.h" | 5 #include "chrome/browser/extensions/api/notifications/notifications_api.h" |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "base/guid.h" | 8 #include "base/guid.h" |
9 #include "base/rand_util.h" | 9 #include "base/rand_util.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
561 | 561 |
562 NotificationsGetAllFunction::NotificationsGetAllFunction() {} | 562 NotificationsGetAllFunction::NotificationsGetAllFunction() {} |
563 | 563 |
564 NotificationsGetAllFunction::~NotificationsGetAllFunction() {} | 564 NotificationsGetAllFunction::~NotificationsGetAllFunction() {} |
565 | 565 |
566 bool NotificationsGetAllFunction::RunNotificationsApi() { | 566 bool NotificationsGetAllFunction::RunNotificationsApi() { |
567 NotificationUIManager* notification_ui_manager = | 567 NotificationUIManager* notification_ui_manager = |
568 g_browser_process->notification_ui_manager(); | 568 g_browser_process->notification_ui_manager(); |
569 std::set<std::string> notification_ids = | 569 std::set<std::string> notification_ids = |
570 notification_ui_manager->GetAllIdsByProfileAndSourceOrigin( | 570 notification_ui_manager->GetAllIdsByProfileAndSourceOrigin( |
571 GetProfile(), extension_->url()); | 571 NotificationUIManager::GetProfileID(GetProfile()), extension_->url()); |
572 | 572 |
573 scoped_ptr<base::DictionaryValue> result(new base::DictionaryValue()); | 573 scoped_ptr<base::DictionaryValue> result(new base::DictionaryValue()); |
574 | 574 |
575 for (std::set<std::string>::iterator iter = notification_ids.begin(); | 575 for (std::set<std::string>::iterator iter = notification_ids.begin(); |
576 iter != notification_ids.end(); iter++) { | 576 iter != notification_ids.end(); iter++) { |
577 result->SetBooleanWithoutPathExpansion( | 577 result->SetBooleanWithoutPathExpansion( |
578 StripScopeFromIdentifier(extension_->id(), *iter), true); | 578 StripScopeFromIdentifier(extension_->id(), *iter), true); |
579 } | 579 } |
580 | 580 |
581 SetResult(result.release()); | 581 SetResult(result.release()); |
(...skipping 18 matching lines...) Expand all Loading... |
600 ? api::notifications::PERMISSION_LEVEL_GRANTED | 600 ? api::notifications::PERMISSION_LEVEL_GRANTED |
601 : api::notifications::PERMISSION_LEVEL_DENIED; | 601 : api::notifications::PERMISSION_LEVEL_DENIED; |
602 | 602 |
603 SetResult(new base::StringValue(api::notifications::ToString(result))); | 603 SetResult(new base::StringValue(api::notifications::ToString(result))); |
604 SendResponse(true); | 604 SendResponse(true); |
605 | 605 |
606 return true; | 606 return true; |
607 } | 607 } |
608 | 608 |
609 } // namespace extensions | 609 } // namespace extensions |
OLD | NEW |