OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011, Google Inc. All rights reserved. | 2 * Copyright (C) 2011, 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 met: | 5 * modification, are permitted provided that the following conditions are met: |
6 * | 6 * |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 namespace WebCore { | 42 namespace WebCore { |
43 | 43 |
44 NavigatorIntents::NavigatorIntents() | 44 NavigatorIntents::NavigatorIntents() |
45 { | 45 { |
46 } | 46 } |
47 | 47 |
48 NavigatorIntents::~NavigatorIntents() | 48 NavigatorIntents::~NavigatorIntents() |
49 { | 49 { |
50 } | 50 } |
51 | 51 |
52 void NavigatorIntents::startActivity(Navigator* navigator, | 52 void NavigatorIntents::webkitStartActivity(Navigator* navigator, |
53 PassRefPtr<Intent> intent, | 53 PassRefPtr<Intent> intent, |
54 PassRefPtr<IntentResultCallback> successCal
lback, | 54 PassRefPtr<IntentResultCallback> succ
essCallback, |
55 PassRefPtr<IntentResultCallback> errorCallb
ack, | 55 PassRefPtr<IntentResultCallback> erro
rCallback, |
56 ExceptionCode& ec) | 56 ExceptionCode& ec) |
57 { | 57 { |
58 if (!navigator->frame() || !intent) { | 58 if (!navigator->frame() || !intent) { |
59 ec = INVALID_STATE_ERR; | 59 ec = INVALID_STATE_ERR; |
60 return; | 60 return; |
61 } | 61 } |
62 | 62 |
63 if (intent->action().isEmpty() || intent->type().isEmpty()) { | 63 if (intent->action().isEmpty() || intent->type().isEmpty()) { |
64 ec = VALIDATION_ERR; | 64 ec = VALIDATION_ERR; |
65 return; | 65 return; |
66 } | 66 } |
67 | 67 |
68 if (!ScriptController::processingUserGesture()) { | 68 if (!ScriptController::processingUserGesture()) { |
69 ec = INVALID_ACCESS_ERR; | 69 ec = INVALID_ACCESS_ERR; |
70 return; | 70 return; |
71 } | 71 } |
72 | 72 |
73 RefPtr<IntentRequest> request = IntentRequest::create(navigator->frame()->do
cument(), | 73 RefPtr<IntentRequest> request = IntentRequest::create(navigator->frame()->do
cument(), |
74 intent, successCallbac
k, errorCallback); | 74 intent, successCallbac
k, errorCallback); |
75 navigator->frame()->loader()->client()->dispatchIntent(request); | 75 navigator->frame()->loader()->client()->dispatchIntent(request); |
76 } | 76 } |
77 | 77 |
78 } // namespace WebCore | 78 } // namespace WebCore |
79 | 79 |
80 #endif // ENABLE(WEB_INTENTS) | 80 #endif // ENABLE(WEB_INTENTS) |
OLD | NEW |