| 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 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 519 NOTIMPLEMENTED(); | 519 NOTIMPLEMENTED(); |
| 520 #else | 520 #else |
| 521 | 521 |
| 522 Profile* profile = Profile::FromBrowserContext(browser_context); | 522 Profile* profile = Profile::FromBrowserContext(browser_context); |
| 523 DCHECK(profile); | 523 DCHECK(profile); |
| 524 | 524 |
| 525 if (switches::SettingsWindowEnabled()) { | 525 if (switches::SettingsWindowEnabled()) { |
| 526 chrome::ShowContentSettingsExceptionsInWindow( | 526 chrome::ShowContentSettingsExceptionsInWindow( |
| 527 profile, CONTENT_SETTINGS_TYPE_NOTIFICATIONS); | 527 profile, CONTENT_SETTINGS_TYPE_NOTIFICATIONS); |
| 528 } else { | 528 } else { |
| 529 chrome::ScopedTabbedBrowserDisplayer browser_displayer( | 529 chrome::ScopedTabbedBrowserDisplayer browser_displayer(profile); |
| 530 profile, chrome::GetActiveDesktop()); | |
| 531 chrome::ShowContentSettingsExceptions(browser_displayer.browser(), | 530 chrome::ShowContentSettingsExceptions(browser_displayer.browser(), |
| 532 CONTENT_SETTINGS_TYPE_NOTIFICATIONS); | 531 CONTENT_SETTINGS_TYPE_NOTIFICATIONS); |
| 533 } | 532 } |
| 534 | 533 |
| 535 #endif // defined(OS_ANDROID) | 534 #endif // defined(OS_ANDROID) |
| 536 } | 535 } |
| 537 | 536 |
| 538 void PlatformNotificationServiceImpl::SetNotificationUIManagerForTesting( | 537 void PlatformNotificationServiceImpl::SetNotificationUIManagerForTesting( |
| 539 NotificationUIManager* manager) { | 538 NotificationUIManager* manager) { |
| 540 notification_ui_manager_for_tests_ = manager; | 539 notification_ui_manager_for_tests_ = manager; |
| 541 } | 540 } |
| 542 | 541 |
| 543 base::string16 PlatformNotificationServiceImpl::DisplayNameForContextMessage( | 542 base::string16 PlatformNotificationServiceImpl::DisplayNameForContextMessage( |
| 544 Profile* profile, | 543 Profile* profile, |
| 545 const GURL& origin) const { | 544 const GURL& origin) const { |
| 546 #if defined(ENABLE_EXTENSIONS) | 545 #if defined(ENABLE_EXTENSIONS) |
| 547 // If the source is an extension, lookup the display name. | 546 // If the source is an extension, lookup the display name. |
| 548 if (origin.SchemeIs(extensions::kExtensionScheme)) { | 547 if (origin.SchemeIs(extensions::kExtensionScheme)) { |
| 549 const extensions::Extension* extension = | 548 const extensions::Extension* extension = |
| 550 extensions::ExtensionRegistry::Get(profile)->GetExtensionById( | 549 extensions::ExtensionRegistry::Get(profile)->GetExtensionById( |
| 551 origin.host(), extensions::ExtensionRegistry::EVERYTHING); | 550 origin.host(), extensions::ExtensionRegistry::EVERYTHING); |
| 552 DCHECK(extension); | 551 DCHECK(extension); |
| 553 | 552 |
| 554 return base::UTF8ToUTF16(extension->name()); | 553 return base::UTF8ToUTF16(extension->name()); |
| 555 } | 554 } |
| 556 #endif | 555 #endif |
| 557 | 556 |
| 558 return base::string16(); | 557 return base::string16(); |
| 559 } | 558 } |
| OLD | NEW |