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

Side by Side Diff: chrome/browser/guest_view/web_view/chrome_web_view_guest_delegate.cc

Issue 2058233002: Rewrite simple uses of base::ListValue::Append() taking a raw pointer var. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: less comments more ownership Created 4 years, 6 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 5
6 #include "chrome/browser/guest_view/web_view/chrome_web_view_guest_delegate.h" 6 #include "chrome/browser/guest_view/web_view/chrome_web_view_guest_delegate.h"
7 7
8 #include <memory>
8 #include <utility> 9 #include <utility>
9 10
10 #include "base/memory/ptr_util.h" 11 #include "base/memory/ptr_util.h"
11 #include "build/build_config.h" 12 #include "build/build_config.h"
12 #include "chrome/browser/extensions/chrome_extension_web_contents_observer.h" 13 #include "chrome/browser/extensions/chrome_extension_web_contents_observer.h"
13 #include "chrome/browser/favicon/favicon_utils.h" 14 #include "chrome/browser/favicon/favicon_utils.h"
14 #include "chrome/browser/profiles/profile.h" 15 #include "chrome/browser/profiles/profile.h"
15 #include "chrome/browser/renderer_context_menu/render_view_context_menu.h" 16 #include "chrome/browser/renderer_context_menu/render_view_context_menu.h"
16 #include "chrome/browser/ui/ash/ash_util.h" 17 #include "chrome/browser/ui/ash/ash_util.h"
17 #include "chrome/browser/ui/pdf/chrome_pdf_web_contents_helper_client.h" 18 #include "chrome/browser/ui/pdf/chrome_pdf_web_contents_helper_client.h"
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 base::Bind(&ChromeWebViewGuestDelegate::OnAccessibilityStatusChanged, 87 base::Bind(&ChromeWebViewGuestDelegate::OnAccessibilityStatusChanged,
87 weak_ptr_factory_.GetWeakPtr())); 88 weak_ptr_factory_.GetWeakPtr()));
88 #endif 89 #endif
89 } 90 }
90 91
91 // static 92 // static
92 std::unique_ptr<base::ListValue> ChromeWebViewGuestDelegate::MenuModelToValue( 93 std::unique_ptr<base::ListValue> ChromeWebViewGuestDelegate::MenuModelToValue(
93 const ui::SimpleMenuModel& menu_model) { 94 const ui::SimpleMenuModel& menu_model) {
94 std::unique_ptr<base::ListValue> items(new base::ListValue()); 95 std::unique_ptr<base::ListValue> items(new base::ListValue());
95 for (int i = 0; i < menu_model.GetItemCount(); ++i) { 96 for (int i = 0; i < menu_model.GetItemCount(); ++i) {
96 base::DictionaryValue* item_value = new base::DictionaryValue(); 97 std::unique_ptr<base::DictionaryValue> item_value(
98 new base::DictionaryValue());
97 // TODO(lazyboy): We need to expose some kind of enum equivalent of 99 // TODO(lazyboy): We need to expose some kind of enum equivalent of
98 // |command_id| instead of plain integers. 100 // |command_id| instead of plain integers.
99 item_value->SetInteger(webview::kMenuItemCommandId, 101 item_value->SetInteger(webview::kMenuItemCommandId,
100 menu_model.GetCommandIdAt(i)); 102 menu_model.GetCommandIdAt(i));
101 item_value->SetString(webview::kMenuItemLabel, menu_model.GetLabelAt(i)); 103 item_value->SetString(webview::kMenuItemLabel, menu_model.GetLabelAt(i));
102 items->Append(item_value); 104 items->Append(std::move(item_value));
103 } 105 }
104 return items; 106 return items;
105 } 107 }
106 108
107 void ChromeWebViewGuestDelegate::OnShowContextMenu(int request_id) { 109 void ChromeWebViewGuestDelegate::OnShowContextMenu(int request_id) {
108 if (!pending_menu_) 110 if (!pending_menu_)
109 return; 111 return;
110 112
111 // Make sure this was the correct request. 113 // Make sure this was the correct request.
112 if (request_id != pending_context_menu_request_id_) 114 if (request_id != pending_context_menu_request_id_)
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 159
158 void ChromeWebViewGuestDelegate::SetContextMenuPosition( 160 void ChromeWebViewGuestDelegate::SetContextMenuPosition(
159 const gfx::Point& position) { 161 const gfx::Point& position) {
160 if (context_menu_position_ == nullptr) 162 if (context_menu_position_ == nullptr)
161 context_menu_position_.reset(new gfx::Point()); 163 context_menu_position_.reset(new gfx::Point());
162 164
163 *context_menu_position_ = position; 165 *context_menu_position_ = position;
164 } 166 }
165 167
166 } // namespace extensions 168 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_messages_apitest.cc ('k') | chrome/browser/media_galleries/media_galleries_preferences.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698