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

Side by Side Diff: extensions/browser/view_type_utils.cc

Issue 2846743002: Switch SupportsUserData uses to use unique_ptr. (Closed)
Patch Set: Created 3 years, 7 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 "extensions/browser/view_type_utils.h" 5 #include "extensions/browser/view_type_utils.h"
6 6
7 #include "base/lazy_instance.h" 7 #include "base/lazy_instance.h"
8 #include "base/memory/ptr_util.h"
8 #include "content/public/browser/web_contents.h" 9 #include "content/public/browser/web_contents.h"
9 #include "extensions/browser/extensions_browser_client.h" 10 #include "extensions/browser/extensions_browser_client.h"
10 11
11 using content::WebContents; 12 using content::WebContents;
12 13
13 namespace extensions { 14 namespace extensions {
14 15
15 namespace { 16 namespace {
16 17
17 const char kViewTypeUserDataKey[] = "ViewTypeUserData"; 18 const char kViewTypeUserDataKey[] = "ViewTypeUserData";
(...skipping 14 matching lines...) Expand all
32 if (!tab) 33 if (!tab)
33 return VIEW_TYPE_INVALID; 34 return VIEW_TYPE_INVALID;
34 35
35 ViewTypeUserData* user_data = static_cast<ViewTypeUserData*>( 36 ViewTypeUserData* user_data = static_cast<ViewTypeUserData*>(
36 tab->GetUserData(&kViewTypeUserDataKey)); 37 tab->GetUserData(&kViewTypeUserDataKey));
37 38
38 return user_data ? user_data->type() : VIEW_TYPE_INVALID; 39 return user_data ? user_data->type() : VIEW_TYPE_INVALID;
39 } 40 }
40 41
41 void SetViewType(WebContents* tab, ViewType type) { 42 void SetViewType(WebContents* tab, ViewType type) {
42 tab->SetUserData(&kViewTypeUserDataKey, new ViewTypeUserData(type)); 43 tab->SetUserData(&kViewTypeUserDataKey,
44 base::MakeUnique<ViewTypeUserData>(type));
43 45
44 ExtensionsBrowserClient::Get()->AttachExtensionTaskManagerTag(tab, type); 46 ExtensionsBrowserClient::Get()->AttachExtensionTaskManagerTag(tab, type);
45 } 47 }
46 48
47 } // namespace extensions 49 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/guest_view/web_view/web_view_content_script_manager.cc ('k') | extensions/renderer/api_binding_hooks.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698