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

Side by Side Diff: Source/modules/notifications/Notification.cpp

Issue 72363002: Rename es => exceptionState in other than bindings/ (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Retry Created 7 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * Copyright (C) 2009, 2011, 2012 Apple Inc. All rights reserved. 3 * Copyright (C) 2009, 2011, 2012 Apple Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 51
52 namespace WebCore { 52 namespace WebCore {
53 53
54 Notification::Notification() 54 Notification::Notification()
55 : ActiveDOMObject(0) 55 : ActiveDOMObject(0)
56 { 56 {
57 ScriptWrappable::init(this); 57 ScriptWrappable::init(this);
58 } 58 }
59 59
60 #if ENABLE(LEGACY_NOTIFICATIONS) 60 #if ENABLE(LEGACY_NOTIFICATIONS)
61 Notification::Notification(const String& title, const String& body, const String & iconURI, ExecutionContext* context, ExceptionState& es, PassRefPtr<Notificatio nCenter> provider) 61 Notification::Notification(const String& title, const String& body, const String & iconURI, ExecutionContext* context, ExceptionState& exceptionState, PassRefPtr <NotificationCenter> provider)
62 : ActiveDOMObject(context) 62 : ActiveDOMObject(context)
63 , m_title(title) 63 , m_title(title)
64 , m_body(body) 64 , m_body(body)
65 , m_state(Idle) 65 , m_state(Idle)
66 , m_notificationClient(provider->client()) 66 , m_notificationClient(provider->client())
67 { 67 {
68 ASSERT(m_notificationClient); 68 ASSERT(m_notificationClient);
69 69
70 ScriptWrappable::init(this); 70 ScriptWrappable::init(this);
71 if (provider->checkPermission() != NotificationClient::PermissionAllowed) { 71 if (provider->checkPermission() != NotificationClient::PermissionAllowed) {
72 es.throwSecurityError(ExceptionMessages::failedToExecute("createNotifica tion", "NotificationCenter", "Notification permission has not been granted.")); 72 exceptionState.throwSecurityError(ExceptionMessages::failedToExecute("cr eateNotification", "NotificationCenter", "Notification permission has not been g ranted."));
73 return; 73 return;
74 } 74 }
75 75
76 m_icon = iconURI.isEmpty() ? KURL() : executionContext()->completeURL(iconUR I); 76 m_icon = iconURI.isEmpty() ? KURL() : executionContext()->completeURL(iconUR I);
77 if (!m_icon.isEmpty() && !m_icon.isValid()) { 77 if (!m_icon.isEmpty() && !m_icon.isValid()) {
78 es.throwDOMException(SyntaxError, ExceptionMessages::failedToExecute("cr eateNotification", "NotificationCenter", "'" + iconURI + "' is not a valid icon URL.")); 78 exceptionState.throwDOMException(SyntaxError, ExceptionMessages::failedT oExecute("createNotification", "NotificationCenter", "'" + iconURI + "' is not a valid icon URL."));
79 return; 79 return;
80 } 80 }
81 } 81 }
82 #endif 82 #endif
83 83
84 Notification::Notification(ExecutionContext* context, const String& title) 84 Notification::Notification(ExecutionContext* context, const String& title)
85 : ActiveDOMObject(context) 85 : ActiveDOMObject(context)
86 , m_title(title) 86 , m_title(title)
87 , m_state(Idle) 87 , m_state(Idle)
88 , m_asyncRunner(adoptPtr(new AsyncMethodRunner<Notification>(this, &Notifica tion::showSoon))) 88 , m_asyncRunner(adoptPtr(new AsyncMethodRunner<Notification>(this, &Notifica tion::showSoon)))
89 { 89 {
90 ScriptWrappable::init(this); 90 ScriptWrappable::init(this);
91 91
92 m_notificationClient = NotificationController::clientFrom(toDocument(context )->page()); 92 m_notificationClient = NotificationController::clientFrom(toDocument(context )->page());
93 ASSERT(m_notificationClient); 93 ASSERT(m_notificationClient);
94 94
95 m_asyncRunner->runAsync(); 95 m_asyncRunner->runAsync();
96 } 96 }
97 97
98 Notification::~Notification() 98 Notification::~Notification()
99 { 99 {
100 } 100 }
101 101
102 #if ENABLE(LEGACY_NOTIFICATIONS) 102 #if ENABLE(LEGACY_NOTIFICATIONS)
103 PassRefPtr<Notification> Notification::create(const String& title, const String& body, const String& iconURI, ExecutionContext* context, ExceptionState& es, Pas sRefPtr<NotificationCenter> provider) 103 PassRefPtr<Notification> Notification::create(const String& title, const String& body, const String& iconURI, ExecutionContext* context, ExceptionState& excepti onState, PassRefPtr<NotificationCenter> provider)
104 { 104 {
105 RefPtr<Notification> notification(adoptRef(new Notification(title, body, ico nURI, context, es, provider))); 105 RefPtr<Notification> notification(adoptRef(new Notification(title, body, ico nURI, context, exceptionState, provider)));
106 notification->suspendIfNeeded(); 106 notification->suspendIfNeeded();
107 return notification.release(); 107 return notification.release();
108 } 108 }
109 #endif 109 #endif
110 110
111 PassRefPtr<Notification> Notification::create(ExecutionContext* context, const S tring& title, const Dictionary& options) 111 PassRefPtr<Notification> Notification::create(ExecutionContext* context, const S tring& title, const Dictionary& options)
112 { 112 {
113 RefPtr<Notification> notification(adoptRef(new Notification(context, title)) ); 113 RefPtr<Notification> notification(adoptRef(new Notification(context, title)) );
114 String argument; 114 String argument;
115 if (options.get("body", argument)) 115 if (options.get("body", argument))
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 return deniedPermission; 261 return deniedPermission;
262 } 262 }
263 263
264 void Notification::requestPermission(ExecutionContext* context, PassRefPtr<Notif icationPermissionCallback> callback) 264 void Notification::requestPermission(ExecutionContext* context, PassRefPtr<Notif icationPermissionCallback> callback)
265 { 265 {
266 ASSERT(toDocument(context)->page()); 266 ASSERT(toDocument(context)->page());
267 NotificationController::from(toDocument(context)->page())->client()->request Permission(context, callback); 267 NotificationController::from(toDocument(context)->page())->client()->request Permission(context, callback);
268 } 268 }
269 269
270 } // namespace WebCore 270 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/modules/navigatorcontentutils/NavigatorContentUtils.cpp ('k') | Source/modules/notifications/NotificationCenter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698