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

Side by Side Diff: chrome/browser/notifications/notification_object_proxy.cc

Issue 2377553003: Add ShouldDisplayOverFullscreen support to web notifications. (Closed)
Patch Set: Final formatting fixes Created 4 years, 2 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/notifications/notification_object_proxy.h" 5 #include "chrome/browser/notifications/notification_object_proxy.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "chrome/browser/notifications/platform_notification_service_impl.h" 10 #include "chrome/browser/notifications/platform_notification_service_impl.h"
11 #include "content/public/browser/desktop_notification_delegate.h" 11 #include "content/public/browser/desktop_notification_delegate.h"
12 #include "url/gurl.h"
12 13
13 NotificationObjectProxy::NotificationObjectProxy( 14 NotificationObjectProxy::NotificationObjectProxy(
14 content::BrowserContext* browser_context, 15 content::BrowserContext* browser_context,
15 const std::string& notification_id, 16 const std::string& notification_id,
17 const GURL& origin,
16 std::unique_ptr<content::DesktopNotificationDelegate> delegate) 18 std::unique_ptr<content::DesktopNotificationDelegate> delegate)
17 : browser_context_(browser_context), 19 : WebNotificationDelegate(browser_context, notification_id, origin),
18 delegate_(std::move(delegate)), 20 delegate_(std::move(delegate)),
19 displayed_(false), 21 displayed_(false) {}
20 notification_id_(notification_id) {}
21 22
22 NotificationObjectProxy::~NotificationObjectProxy() {} 23 NotificationObjectProxy::~NotificationObjectProxy() {}
23 24
24 void NotificationObjectProxy::Display() { 25 void NotificationObjectProxy::Display() {
25 // This method is called each time the notification is shown to the user 26 // This method is called each time the notification is shown to the user
26 // but we only want to fire the event the first time. 27 // but we only want to fire the event the first time.
27 if (displayed_) 28 if (displayed_)
28 return; 29 return;
29 30
30 displayed_ = true; 31 displayed_ = true;
31 32
32 delegate_->NotificationDisplayed(); 33 delegate_->NotificationDisplayed();
33 } 34 }
34 35
35 void NotificationObjectProxy::Close(bool by_user) { 36 void NotificationObjectProxy::Close(bool by_user) {
36 delegate_->NotificationClosed(); 37 delegate_->NotificationClosed();
37 } 38 }
38 39
39 void NotificationObjectProxy::Click() { 40 void NotificationObjectProxy::Click() {
40 delegate_->NotificationClick(); 41 delegate_->NotificationClick();
41 } 42 }
42 43
43 void NotificationObjectProxy::ButtonClick(int button_index) { 44 void NotificationObjectProxy::ButtonClick(int button_index) {
44 // Notification buttons not are supported for non persistent notifications. 45 // Notification buttons not are supported for non persistent notifications.
45 DCHECK_EQ(button_index, 0); 46 DCHECK_EQ(button_index, 0);
46 47
47 NotificationCommon::OpenNotificationSettings(browser_context_); 48 NotificationCommon::OpenNotificationSettings(browser_context());
48 } 49 }
49
50 void NotificationObjectProxy::SettingsClick() {
51 NotificationCommon::OpenNotificationSettings(browser_context_);
52 }
53
54 bool NotificationObjectProxy::ShouldDisplaySettingsButton() {
55 return true;
56 }
57
58 std::string NotificationObjectProxy::id() const {
59 return notification_id_;
60 }
OLDNEW
« no previous file with comments | « chrome/browser/notifications/notification_object_proxy.h ('k') | chrome/browser/notifications/notification_test_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698