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

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

Issue 2377553003: Add ShouldDisplayOverFullscreen support to web notifications. (Closed)
Patch Set: Removing previously committed changes from cl (via git pull) 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 "chrome/browser/profiles/profile.h"
12 #include "chrome/browser/ui/browser.h"
13 #include "chrome/browser/ui/browser_list.h"
14 #include "chrome/browser/ui/browser_window.h"
15 #include "chrome/browser/ui/exclusive_access/exclusive_access_context.h"
16 #include "chrome/browser/ui/tabs/tab_strip_model.h"
11 #include "content/public/browser/desktop_notification_delegate.h" 17 #include "content/public/browser/desktop_notification_delegate.h"
18 #include "content/public/browser/web_contents.h"
19
20 using content::WebContents;
12 21
13 NotificationObjectProxy::NotificationObjectProxy( 22 NotificationObjectProxy::NotificationObjectProxy(
14 content::BrowserContext* browser_context, 23 content::BrowserContext* browser_context,
15 const std::string& notification_id, 24 const std::string& notification_id,
25 const GURL& origin,
16 std::unique_ptr<content::DesktopNotificationDelegate> delegate) 26 std::unique_ptr<content::DesktopNotificationDelegate> delegate)
17 : browser_context_(browser_context), 27 : WebNotificationDelegate(browser_context, notification_id, origin),
18 delegate_(std::move(delegate)), 28 delegate_(std::move(delegate)),
19 displayed_(false), 29 displayed_(false) {}
20 notification_id_(notification_id) {}
21 30
22 NotificationObjectProxy::~NotificationObjectProxy() {} 31 NotificationObjectProxy::~NotificationObjectProxy() {}
23 32
24 void NotificationObjectProxy::Display() { 33 void NotificationObjectProxy::Display() {
25 // This method is called each time the notification is shown to the user 34 // 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. 35 // but we only want to fire the event the first time.
27 if (displayed_) 36 if (displayed_)
28 return; 37 return;
29 38
30 displayed_ = true; 39 displayed_ = true;
31 40
32 delegate_->NotificationDisplayed(); 41 delegate_->NotificationDisplayed();
33 } 42 }
34 43
35 void NotificationObjectProxy::Close(bool by_user) { 44 void NotificationObjectProxy::Close(bool by_user) {
36 delegate_->NotificationClosed(); 45 delegate_->NotificationClosed();
37 } 46 }
38 47
39 void NotificationObjectProxy::Click() { 48 void NotificationObjectProxy::Click() {
40 delegate_->NotificationClick(); 49 delegate_->NotificationClick();
41 } 50 }
42 51
43 void NotificationObjectProxy::ButtonClick(int button_index) { 52 void NotificationObjectProxy::ButtonClick(int button_index) {
44 // Notification buttons not are supported for non persistent notifications. 53 // Notification buttons not are supported for non persistent notifications.
45 DCHECK_EQ(button_index, 0); 54 DCHECK_EQ(button_index, 0);
46 55
47 NotificationCommon::OpenNotificationSettings(browser_context_); 56 NotificationCommon::OpenNotificationSettings(browser_context());
48 } 57 }
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

Powered by Google App Engine
This is Rietveld 408576698