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

Side by Side Diff: chrome/browser/extensions/api/notifications/notifications_api.cc

Issue 624153002: replace OVERRIDE and FINAL with override and final in chrome/browser/extensions/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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/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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 const std::string& extension_id, 78 const std::string& extension_id,
79 const std::string& id) 79 const std::string& id)
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 virtual void Display() OVERRIDE { } 88 virtual void Display() override { }
89 89
90 virtual void Error() OVERRIDE {} 90 virtual void Error() override {}
91 91
92 virtual void Close(bool by_user) OVERRIDE { 92 virtual void Close(bool by_user) override {
93 EventRouter::UserGestureState gesture = 93 EventRouter::UserGestureState gesture =
94 by_user ? EventRouter::USER_GESTURE_ENABLED 94 by_user ? EventRouter::USER_GESTURE_ENABLED
95 : EventRouter::USER_GESTURE_NOT_ENABLED; 95 : EventRouter::USER_GESTURE_NOT_ENABLED;
96 scoped_ptr<base::ListValue> args(CreateBaseEventArgs()); 96 scoped_ptr<base::ListValue> args(CreateBaseEventArgs());
97 args->Append(new base::FundamentalValue(by_user)); 97 args->Append(new base::FundamentalValue(by_user));
98 SendEvent(notifications::OnClosed::kEventName, gesture, args.Pass()); 98 SendEvent(notifications::OnClosed::kEventName, gesture, args.Pass());
99 } 99 }
100 100
101 virtual void Click() OVERRIDE { 101 virtual void Click() override {
102 scoped_ptr<base::ListValue> args(CreateBaseEventArgs()); 102 scoped_ptr<base::ListValue> args(CreateBaseEventArgs());
103 SendEvent(notifications::OnClicked::kEventName, 103 SendEvent(notifications::OnClicked::kEventName,
104 EventRouter::USER_GESTURE_ENABLED, 104 EventRouter::USER_GESTURE_ENABLED,
105 args.Pass()); 105 args.Pass());
106 } 106 }
107 107
108 virtual bool HasClickedListener() OVERRIDE { 108 virtual bool HasClickedListener() override {
109 return EventRouter::Get(profile_)->HasEventListener( 109 return EventRouter::Get(profile_)->HasEventListener(
110 notifications::OnClicked::kEventName); 110 notifications::OnClicked::kEventName);
111 } 111 }
112 112
113 virtual void ButtonClick(int index) OVERRIDE { 113 virtual void ButtonClick(int index) override {
114 scoped_ptr<base::ListValue> args(CreateBaseEventArgs()); 114 scoped_ptr<base::ListValue> args(CreateBaseEventArgs());
115 args->Append(new base::FundamentalValue(index)); 115 args->Append(new base::FundamentalValue(index));
116 SendEvent(notifications::OnButtonClicked::kEventName, 116 SendEvent(notifications::OnButtonClicked::kEventName,
117 EventRouter::USER_GESTURE_ENABLED, 117 EventRouter::USER_GESTURE_ENABLED,
118 args.Pass()); 118 args.Pass());
119 } 119 }
120 120
121 virtual std::string id() const OVERRIDE { 121 virtual std::string id() const override {
122 return scoped_id_; 122 return scoped_id_;
123 } 123 }
124 124
125 virtual content::WebContents* GetWebContents() const OVERRIDE { 125 virtual content::WebContents* GetWebContents() const override {
126 // We're holding a reference to api_function_, so we know it'll be valid 126 // We're holding a reference to api_function_, so we know it'll be valid
127 // until ReleaseRVH is called, and api_function_ (as a 127 // until ReleaseRVH is called, and api_function_ (as a
128 // AsyncExtensionFunction) will zero out its copy of render_view_host 128 // AsyncExtensionFunction) will zero out its copy of render_view_host
129 // when the RVH goes away. 129 // when the RVH goes away.
130 if (!api_function_.get()) 130 if (!api_function_.get())
131 return NULL; 131 return NULL;
132 content::RenderViewHost* rvh = api_function_->render_view_host(); 132 content::RenderViewHost* rvh = api_function_->render_view_host();
133 if (!rvh) 133 if (!rvh)
134 return NULL; 134 return NULL;
135 return content::WebContents::FromRenderViewHost(rvh); 135 return content::WebContents::FromRenderViewHost(rvh);
136 } 136 }
137 137
138 virtual void ReleaseRenderViewHost() OVERRIDE { 138 virtual void ReleaseRenderViewHost() override {
139 api_function_ = NULL; 139 api_function_ = NULL;
140 } 140 }
141 141
142 private: 142 private:
143 virtual ~NotificationsApiDelegate() {} 143 virtual ~NotificationsApiDelegate() {}
144 144
145 void SendEvent(const std::string& name, 145 void SendEvent(const std::string& name,
146 EventRouter::UserGestureState user_gesture, 146 EventRouter::UserGestureState user_gesture,
147 scoped_ptr<base::ListValue> args) { 147 scoped_ptr<base::ListValue> args) {
148 scoped_ptr<Event> event(new Event(name, args.Pass())); 148 scoped_ptr<Event> event(new Event(name, args.Pass()));
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after
622 ? api::notifications::PERMISSION_LEVEL_GRANTED 622 ? api::notifications::PERMISSION_LEVEL_GRANTED
623 : api::notifications::PERMISSION_LEVEL_DENIED; 623 : api::notifications::PERMISSION_LEVEL_DENIED;
624 624
625 SetResult(new base::StringValue(api::notifications::ToString(result))); 625 SetResult(new base::StringValue(api::notifications::ToString(result)));
626 SendResponse(true); 626 SendResponse(true);
627 627
628 return true; 628 return true;
629 } 629 }
630 630
631 } // namespace extensions 631 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698