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

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

Issue 580243004: Remove unnecessary image downloading handler of notifications. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: build fix of desktop linux/win 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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 {
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
128 // AsyncExtensionFunction) will zero out its copy of render_view_host
129 // when the RVH goes away.
130 if (!api_function_.get())
131 return NULL;
132 content::RenderViewHost* rvh = api_function_->render_view_host();
133 if (!rvh)
134 return NULL;
135 return content::WebContents::FromRenderViewHost(rvh);
136 }
137
138 virtual void ReleaseRenderViewHost() override {
139 api_function_ = NULL;
140 }
141
142 private: 125 private:
143 virtual ~NotificationsApiDelegate() {} 126 virtual ~NotificationsApiDelegate() {}
144 127
145 void SendEvent(const std::string& name, 128 void SendEvent(const std::string& name,
146 EventRouter::UserGestureState user_gesture, 129 EventRouter::UserGestureState user_gesture,
147 scoped_ptr<base::ListValue> args) { 130 scoped_ptr<base::ListValue> args) {
148 scoped_ptr<Event> event(new Event(name, args.Pass())); 131 scoped_ptr<Event> event(new Event(name, args.Pass()));
149 event->user_gesture = user_gesture; 132 event->user_gesture = user_gesture;
150 EventRouter::Get(profile_)->DispatchEventToExtension(extension_id_, 133 EventRouter::Get(profile_)->DispatchEventToExtension(extension_id_,
151 event.Pass()); 134 event.Pass());
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after
624 ? api::notifications::PERMISSION_LEVEL_GRANTED 607 ? api::notifications::PERMISSION_LEVEL_GRANTED
625 : api::notifications::PERMISSION_LEVEL_DENIED; 608 : api::notifications::PERMISSION_LEVEL_DENIED;
626 609
627 SetResult(new base::StringValue(api::notifications::ToString(result))); 610 SetResult(new base::StringValue(api::notifications::ToString(result)));
628 SendResponse(true); 611 SendResponse(true);
629 612
630 return true; 613 return true;
631 } 614 }
632 615
633 } // namespace extensions 616 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/power/peripheral_battery_observer.cc ('k') | chrome/browser/local_discovery/privet_notifications.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698