| 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/notifications/balloon.h" | 5 #include "chrome/browser/notifications/balloon.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "chrome/browser/extensions/extension_service.h" | 8 #include "chrome/browser/extensions/extension_service.h" |
| 9 #include "chrome/browser/notifications/balloon_collection.h" | 9 #include "chrome/browser/notifications/balloon_collection.h" |
| 10 #include "chrome/browser/notifications/notification.h" | 10 #include "chrome/browser/notifications/notification.h" |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 } | 75 } |
| 76 | 76 |
| 77 void Balloon::CloseByScript() { | 77 void Balloon::CloseByScript() { |
| 78 // A user-initiated close begins with the view and then closes this object; | 78 // A user-initiated close begins with the view and then closes this object; |
| 79 // we simulate that with a script-initiated close but pass |by_user|=false. | 79 // we simulate that with a script-initiated close but pass |by_user|=false. |
| 80 DCHECK(balloon_view_.get()); | 80 DCHECK(balloon_view_.get()); |
| 81 balloon_view_->Close(false); | 81 balloon_view_->Close(false); |
| 82 } | 82 } |
| 83 | 83 |
| 84 std::string Balloon::GetExtensionId() { | 84 std::string Balloon::GetExtensionId() { |
| 85 const ExtensionURLInfo url(notification().origin_url()); | |
| 86 const ExtensionService* service = profile()->GetExtensionService(); | 85 const ExtensionService* service = profile()->GetExtensionService(); |
| 87 const extensions::Extension* extension = | 86 const extensions::Extension* extension = |
| 88 service->extensions()->GetExtensionOrAppByURL(url); | 87 service->extensions()->GetExtensionOrAppByURL( |
| 88 notification().origin_url()); |
| 89 return extension ? extension->id() : std::string(); | 89 return extension ? extension->id() : std::string(); |
| 90 } | 90 } |
| OLD | NEW |