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

Side by Side Diff: components/renderer_context_menu/context_menu_delegate.cc

Issue 666133002: Standardize usage of virtual/override/final in components/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 #include "components/renderer_context_menu/context_menu_delegate.h" 5 #include "components/renderer_context_menu/context_menu_delegate.h"
6 6
7 #include "content/public/browser/web_contents.h" 7 #include "content/public/browser/web_contents.h"
8 8
9 namespace { 9 namespace {
10 10
11 const char kMenuDelegateUserDataKey[] = "RendererContextMenuMenuDelegate"; 11 const char kMenuDelegateUserDataKey[] = "RendererContextMenuMenuDelegate";
12 12
13 class ContextMenuDelegateUserData : public base::SupportsUserData::Data { 13 class ContextMenuDelegateUserData : public base::SupportsUserData::Data {
14 public: 14 public:
15 explicit ContextMenuDelegateUserData(ContextMenuDelegate* menu_delegate) 15 explicit ContextMenuDelegateUserData(ContextMenuDelegate* menu_delegate)
16 : menu_delegate_(menu_delegate) {} 16 : menu_delegate_(menu_delegate) {}
17 virtual ~ContextMenuDelegateUserData() {} 17 ~ContextMenuDelegateUserData() override {}
18 ContextMenuDelegate* menu_delegate() { return menu_delegate_; } 18 ContextMenuDelegate* menu_delegate() { return menu_delegate_; }
19 19
20 private: 20 private:
21 ContextMenuDelegate* menu_delegate_; // not owned by us. 21 ContextMenuDelegate* menu_delegate_; // not owned by us.
22 }; 22 };
23 23
24 } // namespace 24 } // namespace
25 25
26 ContextMenuDelegate::ContextMenuDelegate(content::WebContents* web_contents) { 26 ContextMenuDelegate::ContextMenuDelegate(content::WebContents* web_contents) {
27 web_contents->SetUserData(&kMenuDelegateUserDataKey, 27 web_contents->SetUserData(&kMenuDelegateUserDataKey,
28 new ContextMenuDelegateUserData(this)); 28 new ContextMenuDelegateUserData(this));
29 } 29 }
30 30
31 ContextMenuDelegate::~ContextMenuDelegate() { 31 ContextMenuDelegate::~ContextMenuDelegate() {
32 } 32 }
33 33
34 // static 34 // static
35 ContextMenuDelegate* ContextMenuDelegate::FromWebContents( 35 ContextMenuDelegate* ContextMenuDelegate::FromWebContents(
36 content::WebContents* web_contents) { 36 content::WebContents* web_contents) {
37 ContextMenuDelegateUserData* user_data = 37 ContextMenuDelegateUserData* user_data =
38 static_cast<ContextMenuDelegateUserData*>( 38 static_cast<ContextMenuDelegateUserData*>(
39 web_contents->GetUserData(&kMenuDelegateUserDataKey)); 39 web_contents->GetUserData(&kMenuDelegateUserDataKey));
40 return user_data ? user_data->menu_delegate() : NULL; 40 return user_data ? user_data->menu_delegate() : NULL;
41 } 41 }
OLDNEW
« no previous file with comments | « components/rappor/log_uploader_unittest.cc ('k') | components/renderer_context_menu/render_view_context_menu_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698