| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/platform_notification_service_impl.h" | 5 #include "chrome/browser/notifications/platform_notification_service_impl.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 509 NOTIMPLEMENTED(); | 509 NOTIMPLEMENTED(); |
| 510 #else | 510 #else |
| 511 | 511 |
| 512 Profile* profile = Profile::FromBrowserContext(browser_context); | 512 Profile* profile = Profile::FromBrowserContext(browser_context); |
| 513 DCHECK(profile); | 513 DCHECK(profile); |
| 514 | 514 |
| 515 if (switches::SettingsWindowEnabled()) { | 515 if (switches::SettingsWindowEnabled()) { |
| 516 chrome::ShowContentSettingsExceptionsInWindow( | 516 chrome::ShowContentSettingsExceptionsInWindow( |
| 517 profile, CONTENT_SETTINGS_TYPE_NOTIFICATIONS); | 517 profile, CONTENT_SETTINGS_TYPE_NOTIFICATIONS); |
| 518 } else { | 518 } else { |
| 519 chrome::ScopedTabbedBrowserDisplayer browser_displayer( | 519 chrome::ScopedTabbedBrowserDisplayer browser_displayer(profile); |
| 520 profile, chrome::GetActiveDesktop()); | |
| 521 chrome::ShowContentSettingsExceptions(browser_displayer.browser(), | 520 chrome::ShowContentSettingsExceptions(browser_displayer.browser(), |
| 522 CONTENT_SETTINGS_TYPE_NOTIFICATIONS); | 521 CONTENT_SETTINGS_TYPE_NOTIFICATIONS); |
| 523 } | 522 } |
| 524 | 523 |
| 525 #endif // defined(OS_ANDROID) | 524 #endif // defined(OS_ANDROID) |
| 526 } | 525 } |
| 527 | 526 |
| 528 void PlatformNotificationServiceImpl::SetNotificationUIManagerForTesting( | 527 void PlatformNotificationServiceImpl::SetNotificationUIManagerForTesting( |
| 529 NotificationUIManager* manager) { | 528 NotificationUIManager* manager) { |
| 530 notification_ui_manager_for_tests_ = manager; | 529 notification_ui_manager_for_tests_ = manager; |
| 531 } | 530 } |
| 532 | 531 |
| 533 base::string16 PlatformNotificationServiceImpl::DisplayNameForContextMessage( | 532 base::string16 PlatformNotificationServiceImpl::DisplayNameForContextMessage( |
| 534 Profile* profile, | 533 Profile* profile, |
| 535 const GURL& origin) const { | 534 const GURL& origin) const { |
| 536 #if defined(ENABLE_EXTENSIONS) | 535 #if defined(ENABLE_EXTENSIONS) |
| 537 // If the source is an extension, lookup the display name. | 536 // If the source is an extension, lookup the display name. |
| 538 if (origin.SchemeIs(extensions::kExtensionScheme)) { | 537 if (origin.SchemeIs(extensions::kExtensionScheme)) { |
| 539 const extensions::Extension* extension = | 538 const extensions::Extension* extension = |
| 540 extensions::ExtensionRegistry::Get(profile)->GetExtensionById( | 539 extensions::ExtensionRegistry::Get(profile)->GetExtensionById( |
| 541 origin.host(), extensions::ExtensionRegistry::EVERYTHING); | 540 origin.host(), extensions::ExtensionRegistry::EVERYTHING); |
| 542 DCHECK(extension); | 541 DCHECK(extension); |
| 543 | 542 |
| 544 return base::UTF8ToUTF16(extension->name()); | 543 return base::UTF8ToUTF16(extension->name()); |
| 545 } | 544 } |
| 546 #endif | 545 #endif |
| 547 | 546 |
| 548 return base::string16(); | 547 return base::string16(); |
| 549 } | 548 } |
| OLD | NEW |