Commit 16cf06fd authored by Johann's avatar Johann Committed by Commit Bot

docs: update examples to follow styleguide

Remove usage of DISALLOW_COPY_AND_ASSIGN from documentation.

styleguide/c++/c++-dos-and-donts.md:
'DISALLOW_COPY_AND_ASSIGN` is deprecated.  For
a non-copyable/movable type, delete the copy operations (the move
operations will be implicitly deleted); otherwise, declare either
copy operations, move operations, or both (a non-declared pair
will be implicitly deleted).  Always declare or delete both
construction and assignment, not just one (which can introduce
subtle bugs).

Change-Id: I2d2e0ecf95c3ef764dc90d49c674625c15432d87
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2404905Reviewed-by: default avatarTal Pressman <talp@chromium.org>
Reviewed-by: default avatarFinnur Thorarinsson <finnur@chromium.org>
Commit-Queue: Johann Koenig <johannkoenig@google.com>
Cr-Commit-Position: refs/heads/master@{#806782}
parent e94dd991
...@@ -50,6 +50,8 @@ class TitleLoggerTabHelper ...@@ -50,6 +50,8 @@ class TitleLoggerTabHelper
: public content::WebContentsObserver, : public content::WebContentsObserver,
public content::WebContentsUserData<TitleLoggerTabHelper> { public content::WebContentsUserData<TitleLoggerTabHelper> {
public: public:
TitleLoggerTabHelper(const TitleLoggerTabHelper&) = delete;
TitleLoggerTabHelper& operator=(const TitleLoggerTabHelper&) = delete;
~TitleLoggerTabHelper() override; ~TitleLoggerTabHelper() override;
// content::WebContentsObserver // content::WebContentsObserver
...@@ -60,8 +62,6 @@ class TitleLoggerTabHelper ...@@ -60,8 +62,6 @@ class TitleLoggerTabHelper
private: private:
explicit TitleLoggerTabHelper(content::WebContents* web_contents); explicit TitleLoggerTabHelper(content::WebContents* web_contents);
friend class content::WebContentsUserData<TitleLoggerTabHelper>; friend class content::WebContentsUserData<TitleLoggerTabHelper>;
DISALLOW_COPY_AND_ASSIGN(TitleLoggerTabHelper);
}; };
``` ```
......
...@@ -142,9 +142,10 @@ Next we need a class to handle requests to this new resource URL. Typically this ...@@ -142,9 +142,10 @@ Next we need a class to handle requests to this new resource URL. Typically this
class HelloWorldUI : public content::WebUIController { class HelloWorldUI : public content::WebUIController {
public: public:
explicit HelloWorldUI(content::WebUI* web_ui); explicit HelloWorldUI(content::WebUI* web_ui);
HelloWorldUI(const HelloWorldUI&) = delete;
HelloWorldUI& operator=(const HelloWorldUI&) = delete;
~HelloWorldUI() override; ~HelloWorldUI() override;
private: private:
DISALLOW_COPY_AND_ASSIGN(HelloWorldUI);
}; };
#endif // COMPONENTS_HELLO_WORLD_HELLO_WORLD_UI_H_ #endif // COMPONENTS_HELLO_WORLD_HELLO_WORLD_UI_H_
...@@ -257,8 +258,6 @@ You probably want your new WebUI page to be able to do something or get informat ...@@ -257,8 +258,6 @@ You probably want your new WebUI page to be able to do something or get informat
+ private: + private:
+ // Add two numbers together using integer arithmetic. + // Add two numbers together using integer arithmetic.
+ void AddNumbers(const base::ListValue* args); + void AddNumbers(const base::ListValue* args);
DISALLOW_COPY_AND_ASSIGN(HelloWorldUI);
}; };
``` ```
......
...@@ -97,14 +97,14 @@ GizmoFrobulateFunction : public ExtensionFunction { ...@@ -97,14 +97,14 @@ GizmoFrobulateFunction : public ExtensionFunction {
DECLARE_EXTENSION_FUNCTION("gizmo.frobulate", GIZMO_FROBULATE) DECLARE_EXTENSION_FUNCTION("gizmo.frobulate", GIZMO_FROBULATE)
GizmoFrobulateFunction(); GizmoFrobulateFunction();
GizmoFrobulateFunction(const GizmoFrobulateFunction&) = delete;
GizmoFrobulateFunction& operator=(const GizmoFrobulateFunction&) = delete;
private: private:
~GizmoFrobulateFunction() override; ~GizmoFrobulateFunction() override;
// ExtensionFunction: // ExtensionFunction:
ResponseAction Run() override; ResponseAction Run() override;
DISALLOW_COPY_AND_ASSIGN(GizmoFrobulateFunction);
}; };
``` ```
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment