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

Side by Side Diff: extensions/browser/guest_view/guest_view_base.h

Issue 611563002: GuestView: Use Weak Pointers Throughout (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed bug where openers become NULL before WillDestroy 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #ifndef EXTENSIONS_BROWSER_GUEST_VIEW_GUEST_VIEW_BASE_H_ 5 #ifndef EXTENSIONS_BROWSER_GUEST_VIEW_GUEST_VIEW_BASE_H_
6 #define EXTENSIONS_BROWSER_GUEST_VIEW_GUEST_VIEW_BASE_H_ 6 #define EXTENSIONS_BROWSER_GUEST_VIEW_GUEST_VIEW_BASE_H_
7 7
8 #include <queue> 8 #include <queue>
9 9
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 178
179 bool IsViewType(const char* const view_type) const { 179 bool IsViewType(const char* const view_type) const {
180 return !strcmp(GetViewType(), view_type); 180 return !strcmp(GetViewType(), view_type);
181 } 181 }
182 182
183 // Toggles autosize mode for this GuestView. 183 // Toggles autosize mode for this GuestView.
184 void SetAutoSize(bool enabled, 184 void SetAutoSize(bool enabled,
185 const gfx::Size& min_size, 185 const gfx::Size& min_size,
186 const gfx::Size& max_size); 186 const gfx::Size& max_size);
187 187
188 base::WeakPtr<GuestViewBase> AsWeakPtr();
189
190 bool initialized() const { return initialized_; } 188 bool initialized() const { return initialized_; }
191 189
192 content::WebContents* embedder_web_contents() const { 190 content::WebContents* embedder_web_contents() const {
193 return embedder_web_contents_; 191 return embedder_web_contents_;
194 } 192 }
195 193
196 // Returns the parameters associated with the element hosting this GuestView 194 // Returns the parameters associated with the element hosting this GuestView
197 // passed in from JavaScript. 195 // passed in from JavaScript.
198 base::DictionaryValue* attach_params() const { return attach_params_.get(); } 196 base::DictionaryValue* attach_params() const { return attach_params_.get(); }
199 197
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 // This is used to ensure pending tasks will not fire after this object is 341 // This is used to ensure pending tasks will not fire after this object is
344 // destroyed. 342 // destroyed.
345 base::WeakPtrFactory<GuestViewBase> weak_ptr_factory_; 343 base::WeakPtrFactory<GuestViewBase> weak_ptr_factory_;
346 344
347 DISALLOW_COPY_AND_ASSIGN(GuestViewBase); 345 DISALLOW_COPY_AND_ASSIGN(GuestViewBase);
348 }; 346 };
349 347
350 } // namespace extensions 348 } // namespace extensions
351 349
352 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_GUEST_VIEW_BASE_H_ 350 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_GUEST_VIEW_BASE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698