OLD | NEW |
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/extensions/api/notifications/notifications_api.h" | 5 #include "chrome/browser/extensions/api/notifications/notifications_api.h" |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "base/guid.h" | 8 #include "base/guid.h" |
9 #include "base/rand_util.h" | 9 #include "base/rand_util.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 : api_function_(api_function), | 80 : api_function_(api_function), |
81 profile_(profile), | 81 profile_(profile), |
82 extension_id_(extension_id), | 82 extension_id_(extension_id), |
83 id_(id), | 83 id_(id), |
84 scoped_id_(CreateScopedIdentifier(extension_id, id)) { | 84 scoped_id_(CreateScopedIdentifier(extension_id, id)) { |
85 DCHECK(api_function_.get()); | 85 DCHECK(api_function_.get()); |
86 } | 86 } |
87 | 87 |
88 void Display() override {} | 88 void Display() override {} |
89 | 89 |
90 void Error() override {} | |
91 | |
92 void Close(bool by_user) override { | 90 void Close(bool by_user) override { |
93 EventRouter::UserGestureState gesture = | 91 EventRouter::UserGestureState gesture = |
94 by_user ? EventRouter::USER_GESTURE_ENABLED | 92 by_user ? EventRouter::USER_GESTURE_ENABLED |
95 : EventRouter::USER_GESTURE_NOT_ENABLED; | 93 : EventRouter::USER_GESTURE_NOT_ENABLED; |
96 scoped_ptr<base::ListValue> args(CreateBaseEventArgs()); | 94 scoped_ptr<base::ListValue> args(CreateBaseEventArgs()); |
97 args->Append(new base::FundamentalValue(by_user)); | 95 args->Append(new base::FundamentalValue(by_user)); |
98 SendEvent(notifications::OnClosed::kEventName, gesture, args.Pass()); | 96 SendEvent(notifications::OnClosed::kEventName, gesture, args.Pass()); |
99 } | 97 } |
100 | 98 |
101 void Click() override { | 99 void Click() override { |
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
605 ? api::notifications::PERMISSION_LEVEL_GRANTED | 603 ? api::notifications::PERMISSION_LEVEL_GRANTED |
606 : api::notifications::PERMISSION_LEVEL_DENIED; | 604 : api::notifications::PERMISSION_LEVEL_DENIED; |
607 | 605 |
608 SetResult(new base::StringValue(api::notifications::ToString(result))); | 606 SetResult(new base::StringValue(api::notifications::ToString(result))); |
609 SendResponse(true); | 607 SendResponse(true); |
610 | 608 |
611 return true; | 609 return true; |
612 } | 610 } |
613 | 611 |
614 } // namespace extensions | 612 } // namespace extensions |
OLD | NEW |