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

Side by Side Diff: chrome/browser/notifications/platform_notification_service_impl.h

Issue 661643002: Adds a context message of the security origin for web notifications. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adds a bug reference. Created 5 years, 11 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 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 #ifndef CHROME_BROWSER_NOTIFICATIONS_PLATFORM_NOTIFICATION_SERVICE_IMPL_H_ 5 #ifndef CHROME_BROWSER_NOTIFICATIONS_PLATFORM_NOTIFICATION_SERVICE_IMPL_H_
6 #define CHROME_BROWSER_NOTIFICATIONS_PLATFORM_NOTIFICATION_SERVICE_IMPL_H_ 6 #define CHROME_BROWSER_NOTIFICATIONS_PLATFORM_NOTIFICATION_SERVICE_IMPL_H_
7 7
8 #include "base/gtest_prod_util.h" 8 #include "base/gtest_prod_util.h"
9 #include "base/memory/singleton.h" 9 #include "base/memory/singleton.h"
10 #include "base/strings/string16.h" 10 #include "base/strings/string16.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 blink::WebNotificationPermission CheckPermission( 49 blink::WebNotificationPermission CheckPermission(
50 content::ResourceContext* resource_context, 50 content::ResourceContext* resource_context,
51 const GURL& origin, 51 const GURL& origin,
52 int render_process_id) override; 52 int render_process_id) override;
53 void DisplayNotification( 53 void DisplayNotification(
54 content::BrowserContext* browser_context, 54 content::BrowserContext* browser_context,
55 const GURL& origin, 55 const GURL& origin,
56 const SkBitmap& icon, 56 const SkBitmap& icon,
57 const content::PlatformNotificationData& notification_data, 57 const content::PlatformNotificationData& notification_data,
58 scoped_ptr<content::DesktopNotificationDelegate> delegate, 58 scoped_ptr<content::DesktopNotificationDelegate> delegate,
59 int render_process_id,
60 base::Closure* cancel_callback) override; 59 base::Closure* cancel_callback) override;
61 void DisplayPersistentNotification( 60 void DisplayPersistentNotification(
62 content::BrowserContext* browser_context, 61 content::BrowserContext* browser_context,
63 int64 service_worker_registration_id, 62 int64 service_worker_registration_id,
64 const GURL& origin, 63 const GURL& origin,
65 const SkBitmap& icon, 64 const SkBitmap& icon,
66 const content::PlatformNotificationData& notification_data, 65 const content::PlatformNotificationData& notification_data) override;
67 int render_process_id) override;
68 void ClosePersistentNotification( 66 void ClosePersistentNotification(
69 content::BrowserContext* browser_context, 67 content::BrowserContext* browser_context,
70 const std::string& persistent_notification_id) override; 68 const std::string& persistent_notification_id) override;
71 69
72 private: 70 private:
73 friend struct DefaultSingletonTraits<PlatformNotificationServiceImpl>; 71 friend struct DefaultSingletonTraits<PlatformNotificationServiceImpl>;
74 friend class PlatformNotificationServiceBrowserTest; 72 friend class PlatformNotificationServiceBrowserTest;
75 friend class PlatformNotificationServiceTest; 73 friend class PlatformNotificationServiceTest;
76 friend class gcm::PushMessagingBrowserTest; 74 friend class gcm::PushMessagingBrowserTest;
77 FRIEND_TEST_ALL_PREFIXES( 75 FRIEND_TEST_ALL_PREFIXES(
78 PlatformNotificationServiceTest, DisplayNameForOrigin); 76 PlatformNotificationServiceTest, DisplayNameForOrigin);
77 FRIEND_TEST_ALL_PREFIXES(PlatformNotificationServiceTest,
78 TestWebOriginDisplayName);
79 79
80 PlatformNotificationServiceImpl(); 80 PlatformNotificationServiceImpl();
81 ~PlatformNotificationServiceImpl() override; 81 ~PlatformNotificationServiceImpl() override;
82 82
83 // Creates a new Web Notification-based Notification object. 83 // Creates a new Web Notification-based Notification object.
84 // TODO(peter): |delegate| can be a scoped_refptr, but properly passing this 84 // TODO(peter): |delegate| can be a scoped_refptr, but properly passing this
85 // through requires changing a whole lot of Notification constructor calls. 85 // through requires changing a whole lot of Notification constructor calls.
86 Notification CreateNotificationFromData( 86 Notification CreateNotificationFromData(
87 Profile* profile, 87 Profile* profile,
88 const GURL& origin, 88 const GURL& origin,
89 const SkBitmap& icon, 89 const SkBitmap& icon,
90 const content::PlatformNotificationData& notification_data, 90 const content::PlatformNotificationData& notification_data,
91 NotificationDelegate* delegate, 91 NotificationDelegate* delegate) const;
92 int render_process_id) const;
93 92
94 // Overrides the Notification UI Manager to use to |manager|. Only to be 93 // Overrides the Notification UI Manager to use to |manager|. Only to be
95 // used by tests. Tests are responsible for cleaning up after themselves. 94 // used by tests. Tests are responsible for cleaning up after themselves.
96 void SetNotificationUIManagerForTesting(NotificationUIManager* manager); 95 void SetNotificationUIManagerForTesting(NotificationUIManager* manager);
97 96
98 // Returns a display name for an origin in the process id, to be used in 97 // Returns a display name for an origin, to be used in permission infobar or
99 // permission infobar or on the frame of the notification toast. Different 98 // on the frame of the notification toast. Different from the origin itself
100 // from the origin itself when dealing with extensions. 99 // when dealing with extensions.
101 base::string16 DisplayNameForOriginInProcessId(Profile* profile, 100 base::string16 DisplayNameForOrigin(Profile* profile,
102 const GURL& origin, 101 const GURL& origin) const;
103 int process_id) const; 102
103 // Translates a URL into a slightly more readable version that may omit
104 // the port and scheme for common cases.
105 // TODO(dewittj): Remove this when the proper function is implemented in a
106 // chrome/browser/ui library function. See crbug.com/402698.
107 static base::string16 WebOriginDisplayName(const GURL& origin,
108 const std::string& languages);
104 109
105 // Weak reference. Ownership maintains with the test. 110 // Weak reference. Ownership maintains with the test.
106 NotificationUIManager* notification_ui_manager_for_tests_; 111 NotificationUIManager* notification_ui_manager_for_tests_;
107 112
108 DISALLOW_COPY_AND_ASSIGN(PlatformNotificationServiceImpl); 113 DISALLOW_COPY_AND_ASSIGN(PlatformNotificationServiceImpl);
109 }; 114 };
110 115
111 #endif // CHROME_BROWSER_NOTIFICATIONS_PLATFORM_NOTIFICATION_SERVICE_IMPL_H_ 116 #endif // CHROME_BROWSER_NOTIFICATIONS_PLATFORM_NOTIFICATION_SERVICE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698