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

Side by Side Diff: chrome/browser/extensions/api/notifications/notifications_api.cc

Issue 1155453002: Passing ProfileID instead of Profile* to clarify that profile should not be used for making any cal… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changes as per review comments. Created 5 years, 6 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) 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 606 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 617
618 NotificationsGetAllFunction::NotificationsGetAllFunction() {} 618 NotificationsGetAllFunction::NotificationsGetAllFunction() {}
619 619
620 NotificationsGetAllFunction::~NotificationsGetAllFunction() {} 620 NotificationsGetAllFunction::~NotificationsGetAllFunction() {}
621 621
622 bool NotificationsGetAllFunction::RunNotificationsApi() { 622 bool NotificationsGetAllFunction::RunNotificationsApi() {
623 NotificationUIManager* notification_ui_manager = 623 NotificationUIManager* notification_ui_manager =
624 g_browser_process->notification_ui_manager(); 624 g_browser_process->notification_ui_manager();
625 std::set<std::string> notification_ids = 625 std::set<std::string> notification_ids =
626 notification_ui_manager->GetAllIdsByProfileAndSourceOrigin( 626 notification_ui_manager->GetAllIdsByProfileAndSourceOrigin(
627 GetProfile(), extension_->url()); 627 NotificationUIManager::GetProfileID(GetProfile()), extension_->url());
628 628
629 scoped_ptr<base::DictionaryValue> result(new base::DictionaryValue()); 629 scoped_ptr<base::DictionaryValue> result(new base::DictionaryValue());
630 630
631 for (std::set<std::string>::iterator iter = notification_ids.begin(); 631 for (std::set<std::string>::iterator iter = notification_ids.begin();
632 iter != notification_ids.end(); iter++) { 632 iter != notification_ids.end(); iter++) {
633 result->SetBooleanWithoutPathExpansion( 633 result->SetBooleanWithoutPathExpansion(
634 StripScopeFromIdentifier(extension_->id(), *iter), true); 634 StripScopeFromIdentifier(extension_->id(), *iter), true);
635 } 635 }
636 636
637 SetResult(result.release()); 637 SetResult(result.release());
(...skipping 18 matching lines...) Expand all
656 ? api::notifications::PERMISSION_LEVEL_GRANTED 656 ? api::notifications::PERMISSION_LEVEL_GRANTED
657 : api::notifications::PERMISSION_LEVEL_DENIED; 657 : api::notifications::PERMISSION_LEVEL_DENIED;
658 658
659 SetResult(new base::StringValue(api::notifications::ToString(result))); 659 SetResult(new base::StringValue(api::notifications::ToString(result)));
660 SendResponse(true); 660 SendResponse(true);
661 661
662 return true; 662 return true;
663 } 663 }
664 664
665 } // namespace extensions 665 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698