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

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

Issue 16295003: Update chrome/ to use scoped_refptr<T>::get() rather than implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 7 years, 6 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 | Annotate | Revision Log
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/strings/string_number_conversions.h" 8 #include "base/strings/string_number_conversions.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 NotificationsApiDelegate(ApiFunction* api_function, 51 NotificationsApiDelegate(ApiFunction* api_function,
52 Profile* profile, 52 Profile* profile,
53 const std::string& extension_id, 53 const std::string& extension_id,
54 const std::string& id) 54 const std::string& id)
55 : api_function_(api_function), 55 : api_function_(api_function),
56 profile_(profile), 56 profile_(profile),
57 extension_id_(extension_id), 57 extension_id_(extension_id),
58 id_(id), 58 id_(id),
59 scoped_id_(CreateScopedIdentifier(extension_id, id)), 59 scoped_id_(CreateScopedIdentifier(extension_id, id)),
60 process_id_(-1) { 60 process_id_(-1) {
61 DCHECK(api_function_); 61 DCHECK(api_function_.get());
62 if (api_function_->render_view_host()) 62 if (api_function_->render_view_host())
63 process_id_ = api_function->render_view_host()->GetProcess()->GetID(); 63 process_id_ = api_function->render_view_host()->GetProcess()->GetID();
64 } 64 }
65 65
66 virtual void Display() OVERRIDE { } 66 virtual void Display() OVERRIDE { }
67 67
68 virtual void Error() OVERRIDE { 68 virtual void Error() OVERRIDE {
69 scoped_ptr<ListValue> args(CreateBaseEventArgs()); 69 scoped_ptr<ListValue> args(CreateBaseEventArgs());
70 SendEvent(event_names::kOnNotificationError, args.Pass()); 70 SendEvent(event_names::kOnNotificationError, args.Pass());
71 } 71 }
(...skipping 26 matching lines...) Expand all
98 98
99 virtual int process_id() const OVERRIDE { 99 virtual int process_id() const OVERRIDE {
100 return process_id_; 100 return process_id_;
101 } 101 }
102 102
103 virtual content::RenderViewHost* GetRenderViewHost() const OVERRIDE { 103 virtual content::RenderViewHost* GetRenderViewHost() const OVERRIDE {
104 // We're holding a reference to api_function_, so we know it'll be valid 104 // We're holding a reference to api_function_, so we know it'll be valid
105 // until ReleaseRVH is called, and api_function_ (as a 105 // until ReleaseRVH is called, and api_function_ (as a
106 // UIThreadExtensionFunction) will zero out its copy of render_view_host 106 // UIThreadExtensionFunction) will zero out its copy of render_view_host
107 // when the RVH goes away. 107 // when the RVH goes away.
108 if (!api_function_) 108 if (!api_function_.get())
109 return NULL; 109 return NULL;
110 return api_function_->render_view_host(); 110 return api_function_->render_view_host();
111 } 111 }
112 112
113 virtual void ReleaseRenderViewHost() OVERRIDE { 113 virtual void ReleaseRenderViewHost() OVERRIDE {
114 api_function_ = NULL; 114 api_function_ = NULL;
115 } 115 }
116 116
117 private: 117 private:
118 virtual ~NotificationsApiDelegate() {} 118 virtual ~NotificationsApiDelegate() {}
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 StripScopeFromIdentifier(extension_->id(), *iter), true); 391 StripScopeFromIdentifier(extension_->id(), *iter), true);
392 } 392 }
393 393
394 SetResult(result.release()); 394 SetResult(result.release());
395 SendResponse(true); 395 SendResponse(true);
396 396
397 return true; 397 return true;
398 } 398 }
399 399
400 } // namespace extensions 400 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698