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

Side by Side Diff: content/shell/browser/layout_test/layout_test_bluetooth_chooser_factory.cc

Issue 2716583003: Rename Origin.unique() to opaque().
Patch Set: Update new uses post-rebase Created 3 years, 4 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "content/shell/browser/layout_test/layout_test_bluetooth_chooser_factor y.h" 5 #include "content/shell/browser/layout_test/layout_test_bluetooth_chooser_factor y.h"
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "content/public/browser/render_frame_host.h" 10 #include "content/public/browser/render_frame_host.h"
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 94
95 LayoutTestBluetoothChooserFactory::~LayoutTestBluetoothChooserFactory() { 95 LayoutTestBluetoothChooserFactory::~LayoutTestBluetoothChooserFactory() {
96 SendEvent(BluetoothChooser::Event::CANCELLED, ""); 96 SendEvent(BluetoothChooser::Event::CANCELLED, "");
97 } 97 }
98 98
99 std::unique_ptr<BluetoothChooser> 99 std::unique_ptr<BluetoothChooser>
100 LayoutTestBluetoothChooserFactory::RunBluetoothChooser( 100 LayoutTestBluetoothChooserFactory::RunBluetoothChooser(
101 RenderFrameHost* frame, 101 RenderFrameHost* frame,
102 const BluetoothChooser::EventHandler& event_handler) { 102 const BluetoothChooser::EventHandler& event_handler) {
103 const url::Origin origin = frame->GetLastCommittedOrigin(); 103 const url::Origin origin = frame->GetLastCommittedOrigin();
104 DCHECK(!origin.unique()); 104 DCHECK(!origin.opaque());
105 std::string event = "chooser-opened("; 105 std::string event = "chooser-opened(";
106 event += origin.Serialize(); 106 event += origin.Serialize();
107 event += ")"; 107 event += ")";
108 events_.push_back(event); 108 events_.push_back(event);
109 return base::MakeUnique<Chooser>(weak_this_.GetWeakPtr(), event_handler); 109 return base::MakeUnique<Chooser>(weak_this_.GetWeakPtr(), event_handler);
110 } 110 }
111 111
112 std::vector<std::string> 112 std::vector<std::string>
113 LayoutTestBluetoothChooserFactory::GetAndResetEvents() { 113 LayoutTestBluetoothChooserFactory::GetAndResetEvents() {
114 std::vector<std::string> result; 114 std::vector<std::string> result;
115 result.swap(events_); 115 result.swap(events_);
116 return result; 116 return result;
117 } 117 }
118 118
119 void LayoutTestBluetoothChooserFactory::SendEvent( 119 void LayoutTestBluetoothChooserFactory::SendEvent(
120 BluetoothChooser::Event event, 120 BluetoothChooser::Event event,
121 const std::string& device_id) { 121 const std::string& device_id) {
122 // Copy |choosers_| to make sure event handler executions that modify 122 // Copy |choosers_| to make sure event handler executions that modify
123 // |choosers_| don't invalidate iterators. 123 // |choosers_| don't invalidate iterators.
124 std::vector<Chooser*> choosers_copy(choosers_.begin(), choosers_.end()); 124 std::vector<Chooser*> choosers_copy(choosers_.begin(), choosers_.end());
125 for (Chooser* chooser : choosers_copy) { 125 for (Chooser* chooser : choosers_copy) {
126 chooser->event_handler.Run(event, device_id); 126 chooser->event_handler.Run(event, device_id);
127 } 127 }
128 } 128 }
129 129
130 } // namespace content 130 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_frame_impl.cc ('k') | content/shell/browser/shell_content_browser_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698