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

Side by Side Diff: Source/WebCore/bindings/js/JSDesktopNotificationsCustom.cpp

Issue 6594055: Merge 77738 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/648/
Patch Set: Created 9 years, 9 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
« no previous file with comments | « no previous file | Source/WebCore/bindings/v8/custom/V8NotificationCenterCustom.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 29 matching lines...) Expand all
40 #include "Notification.h" 40 #include "Notification.h"
41 #include "NotificationCenter.h" 41 #include "NotificationCenter.h"
42 #include <runtime/Error.h> 42 #include <runtime/Error.h>
43 43
44 using namespace JSC; 44 using namespace JSC;
45 45
46 namespace WebCore { 46 namespace WebCore {
47 47
48 JSValue JSNotificationCenter::requestPermission(ExecState* exec) 48 JSValue JSNotificationCenter::requestPermission(ExecState* exec)
49 { 49 {
50 ScriptExecutionContext* context = impl()->context(); 50 ScriptExecutionContext* context = impl()->scriptExecutionContext();
51 51
52 // Make sure that script execution context is valid. 52 // Make sure that script execution context is valid.
53 if (!context) { 53 if (!context) {
54 setDOMException(exec, INVALID_STATE_ERR); 54 setDOMException(exec, INVALID_STATE_ERR);
55 return jsUndefined(); 55 return jsUndefined();
56 } 56 }
57 57
58 // Permission request is only valid from page context. 58 // Permission request is only valid from page context.
59 if (context->isWorkerContext()) 59 if (context->isWorkerContext())
60 return throwSyntaxError(exec); 60 return throwSyntaxError(exec);
61 61
62 if (!exec->argument(0).isObject()) 62 if (!exec->argument(0).isObject())
63 return throwTypeError(exec); 63 return throwTypeError(exec);
64 64
65 PassRefPtr<JSCustomVoidCallback> callback = JSCustomVoidCallback::create(exe c->argument(0).getObject(), toJSDOMGlobalObject(static_cast<Document*>(context), exec)); 65 PassRefPtr<JSCustomVoidCallback> callback = JSCustomVoidCallback::create(exe c->argument(0).getObject(), toJSDOMGlobalObject(static_cast<Document*>(context), exec));
66 66
67 impl()->requestPermission(callback); 67 impl()->requestPermission(callback);
68 return jsUndefined(); 68 return jsUndefined();
69 } 69 }
70 70
71 } // namespace 71 } // namespace
72 72
73 #endif // ENABLE(NOTIFICATIONS) 73 #endif // ENABLE(NOTIFICATIONS)
OLDNEW
« no previous file with comments | « no previous file | Source/WebCore/bindings/v8/custom/V8NotificationCenterCustom.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698