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

Side by Side Diff: extensions/common/extension_builder.cc

Issue 1511103003: Use rvalue reference instead of ExtensionBuilder::pass() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review (returning rvalue) Created 5 years 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/common/extension_builder.h" 5 #include "extensions/common/extension_builder.h"
6 6
7 #include <utility>
8
7 #include "extensions/common/extension.h" 9 #include "extensions/common/extension.h"
8 10
9 namespace extensions { 11 namespace extensions {
10 12
11 ExtensionBuilder::ExtensionBuilder() 13 ExtensionBuilder::ExtensionBuilder()
12 : location_(Manifest::UNPACKED), 14 : location_(Manifest::UNPACKED),
13 flags_(Extension::NO_FLAGS) { 15 flags_(Extension::NO_FLAGS) {
14 } 16 }
15 ExtensionBuilder::~ExtensionBuilder() {} 17 ExtensionBuilder::~ExtensionBuilder() {}
16 18
19 ExtensionBuilder::ExtensionBuilder(ExtensionBuilder&& other)
20 : path_(std::move(other.path_)),
21 location_(other.location_),
22 manifest_(std::move(other.manifest_)),
23 flags_(other.flags_),
24 id_(std::move(other.id_)) {}
25
26 ExtensionBuilder& ExtensionBuilder::operator=(ExtensionBuilder&& other) {
27 path_ = std::move(other.path_);
28 location_ = other.location_;
29 manifest_ = std::move(other.manifest_);
30 flags_ = other.flags_;
31 id_ = std::move(other.id_);
32 return *this;
33 }
34
17 scoped_refptr<Extension> ExtensionBuilder::Build() { 35 scoped_refptr<Extension> ExtensionBuilder::Build() {
18 std::string error; 36 std::string error;
19 scoped_refptr<Extension> extension = Extension::Create( 37 scoped_refptr<Extension> extension = Extension::Create(
20 path_, 38 path_,
21 location_, 39 location_,
22 *manifest_, 40 *manifest_,
23 flags_, 41 flags_,
24 id_, 42 id_,
25 &error); 43 &error);
26 CHECK_EQ("", error); 44 CHECK_EQ("", error);
(...skipping 25 matching lines...) Expand all
52 flags_ |= init_from_value_flags; 70 flags_ |= init_from_value_flags;
53 return *this; 71 return *this;
54 } 72 }
55 73
56 ExtensionBuilder& ExtensionBuilder::SetID(const std::string& id) { 74 ExtensionBuilder& ExtensionBuilder::SetID(const std::string& id) {
57 id_ = id; 75 id_ = id;
58 return *this; 76 return *this;
59 } 77 }
60 78
61 } // namespace extensions 79 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698