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

Unified Diff: content/browser/devtools/protocol/page_handler.cc

Issue 642263004: [DevTools] Make generated protocol structs wrappers around DictionaryValue (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 side-by-side diff with in-line comments
Download patch
Index: content/browser/devtools/protocol/page_handler.cc
diff --git a/content/browser/devtools/protocol/page_handler.cc b/content/browser/devtools/protocol/page_handler.cc
index 856352e0bcbb9db3ea978e8caac864d5984c9f37..20106878660de98da2e1852215b553d483f71709 100644
--- a/content/browser/devtools/protocol/page_handler.cc
+++ b/content/browser/devtools/protocol/page_handler.cc
@@ -123,15 +123,13 @@ void PageHandler::OnVisibilityChanged(bool visible) {
void PageHandler::DidAttachInterstitialPage() {
if (!enabled_)
return;
- InterstitialShownParams params;
- client_->InterstitialShown(params);
+ client_->InterstitialShown(nullptr);
}
void PageHandler::DidDetachInterstitialPage() {
if (!enabled_)
return;
- InterstitialHiddenParams params;
- client_->InterstitialHidden(params);
+ client_->InterstitialHidden(nullptr);
}
Response PageHandler::Enable() {
@@ -186,7 +184,7 @@ Response PageHandler::Navigate(const std::string& url,
Response PageHandler::GetNavigationHistory(
int* current_index,
- std::vector<NavigationEntry>* entries) {
+ ListBuilder<NavigationEntry>* entries) {
if (!host_)
return Response::InternalError("Could not connect to view");
@@ -197,12 +195,12 @@ Response PageHandler::GetNavigationHistory(
NavigationController& controller = web_contents->GetController();
*current_index = controller.GetCurrentEntryIndex();
for (int i = 0; i != controller.GetEntryCount(); ++i) {
- NavigationEntry entry;
- entry.set_id(controller.GetEntryAtIndex(i)->GetUniqueID());
- entry.set_url(controller.GetEntryAtIndex(i)->GetURL().spec());
- entry.set_title(
+ scoped_ptr<NavigationEntry> entry;
dgozman 2014/10/17 10:51:57 I think, default constructor of scoped_ptr will ha
vkuzkokov 2014/10/17 11:41:26 Not every method.
+ entry->set_id(controller.GetEntryAtIndex(i)->GetUniqueID());
+ entry->set_url(controller.GetEntryAtIndex(i)->GetURL().spec());
+ entry->set_title(
base::UTF16ToUTF8(controller.GetEntryAtIndex(i)->GetTitle()));
- entries->push_back(entry);
+ entries->push_back(entry.Pass());
}
return Response::OK();
}
@@ -415,9 +413,9 @@ void PageHandler::UpdateTouchEventEmulationState() {
void PageHandler::NotifyScreencastVisibility(bool visible) {
if (visible)
capture_retry_count_ = kCaptureRetryLimit;
- ScreencastVisibilityChangedParams params;
- params.set_visible(visible);
- client_->ScreencastVisibilityChanged(params);
+ scoped_ptr<ScreencastVisibilityChangedParams> params;
+ params->set_visible(visible);
+ client_->ScreencastVisibilityChanged(params.Pass());
}
void PageHandler::InnerSwapCompositorFrame() {
@@ -523,7 +521,7 @@ void PageHandler::ScreencastFrameCaptured(
base::StringPiece(reinterpret_cast<char*>(&data[0]), data.size()),
&base_64_data);
- ScreencastFrameMetadata param_metadata;
+ scoped_ptr<ScreencastFrameMetadata> param_metadata;
// Consider metadata empty in case it has no device scale factor.
if (metadata.device_scale_factor != 0 && host_) {
RenderWidgetHostViewBase* view = static_cast<RenderWidgetHostViewBase*>(
@@ -536,32 +534,32 @@ void PageHandler::ScreencastFrameCaptured(
gfx::SizeF screen_size_dip = gfx::ScaleSize(
view->GetPhysicalBackingSize(), 1 / metadata.device_scale_factor);
- param_metadata.set_device_scale_factor(metadata.device_scale_factor);
- param_metadata.set_page_scale_factor(metadata.page_scale_factor);
- param_metadata.set_page_scale_factor_min(metadata.min_page_scale_factor);
- param_metadata.set_page_scale_factor_max(metadata.max_page_scale_factor);
- param_metadata.set_offset_top(
+ param_metadata->set_device_scale_factor(metadata.device_scale_factor);
+ param_metadata->set_page_scale_factor(metadata.page_scale_factor);
+ param_metadata->set_page_scale_factor_min(metadata.min_page_scale_factor);
+ param_metadata->set_page_scale_factor_max(metadata.max_page_scale_factor);
+ param_metadata->set_offset_top(
metadata.location_bar_content_translation.y());
- param_metadata.set_offset_bottom(screen_size_dip.height() -
+ param_metadata->set_offset_bottom(screen_size_dip.height() -
metadata.location_bar_content_translation.y() -
viewport_size_dip.height());
- param_metadata.set_device_width(screen_size_dip.width());
- param_metadata.set_device_height(screen_size_dip.height());
- param_metadata.set_scroll_offset_x(metadata.root_scroll_offset.x());
- param_metadata.set_scroll_offset_y(metadata.root_scroll_offset.y());
-
- devtools::dom::Rect viewport;
- viewport.set_x(metadata.root_scroll_offset.x());
- viewport.set_y(metadata.root_scroll_offset.y());
- viewport.set_width(metadata.scrollable_viewport_size.width());
- viewport.set_height(metadata.scrollable_viewport_size.height());
- param_metadata.set_viewport(viewport);
+ param_metadata->set_device_width(screen_size_dip.width());
+ param_metadata->set_device_height(screen_size_dip.height());
+ param_metadata->set_scroll_offset_x(metadata.root_scroll_offset.x());
+ param_metadata->set_scroll_offset_y(metadata.root_scroll_offset.y());
+
+ scoped_ptr<devtools::dom::Rect> viewport;
+ viewport->set_x(metadata.root_scroll_offset.x());
+ viewport->set_y(metadata.root_scroll_offset.y());
+ viewport->set_width(metadata.scrollable_viewport_size.width());
+ viewport->set_height(metadata.scrollable_viewport_size.height());
+ param_metadata->set_viewport(viewport.Pass());
}
- ScreencastFrameParams params;
- params.set_data(base_64_data);
- params.set_metadata(param_metadata);
- client_->ScreencastFrame(params);
+ scoped_ptr<ScreencastFrameParams> params;
+ params->set_data(base_64_data);
+ params->set_metadata(param_metadata.Pass());
+ client_->ScreencastFrame(params.Pass());
}
void PageHandler::ScreenshotCaptured(
@@ -579,26 +577,26 @@ void PageHandler::ScreenshotCaptured(
base::StringPiece(reinterpret_cast<const char*>(png_data), png_size),
&base_64_data);
- CaptureScreenshotResponse response;
- response.set_data(base_64_data);
- client_->SendCaptureScreenshotResponse(command, response);
+ scoped_ptr<CaptureScreenshotResponse> response;
+ response->set_data(base_64_data);
+ client_->SendCaptureScreenshotResponse(command, response.Pass());
}
void PageHandler::OnColorPicked(int r, int g, int b, int a) {
- dom::RGBA color;
- color.set_r(r);
- color.set_g(g);
- color.set_b(b);
- color.set_a(a);
- ColorPickedParams params;
- params.set_color(color);
- client_->ColorPicked(params);
+ scoped_ptr<dom::RGBA> color;
+ color->set_r(r);
+ color->set_g(g);
+ color->set_b(b);
+ color->set_a(a);
+ scoped_ptr<ColorPickedParams> params;
+ params->set_color(color.Pass());
+ client_->ColorPicked(params.Pass());
}
void PageHandler::QueryUsageAndQuotaCompleted(
scoped_refptr<DevToolsProtocol::Command> command,
scoped_ptr<QueryUsageAndQuotaResponse> response_data) {
- client_->SendQueryUsageAndQuotaResponse(command, *response_data);
+ client_->SendQueryUsageAndQuotaResponse(command, response_data.Pass());
}
} // namespace page

Powered by Google App Engine
This is Rietveld 408576698