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

Side by Side Diff: chrome/browser/ui/webui/offline_internals_ui.cc

Issue 2180113003: Make sure the Async test cases availabel today generate correct ClientID. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "chrome/browser/ui/webui/offline_internals_ui.h" 5 #include "chrome/browser/ui/webui/offline_internals_ui.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <stdlib.h> 8 #include <stdlib.h>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/guid.h"
12 #include "base/macros.h" 13 #include "base/macros.h"
13 #include "base/memory/weak_ptr.h" 14 #include "base/memory/weak_ptr.h"
14 #include "base/strings/string_number_conversions.h" 15 #include "base/strings/string_number_conversions.h"
15 #include "base/values.h" 16 #include "base/values.h"
16 #include "chrome/browser/android/offline_pages/offline_page_model_factory.h" 17 #include "chrome/browser/android/offline_pages/offline_page_model_factory.h"
17 #include "chrome/browser/android/offline_pages/request_coordinator_factory.h" 18 #include "chrome/browser/android/offline_pages/request_coordinator_factory.h"
18 #include "chrome/browser/profiles/profile.h" 19 #include "chrome/browser/profiles/profile.h"
19 #include "chrome/common/url_constants.h" 20 #include "chrome/common/url_constants.h"
20 #include "components/offline_pages/background/request_coordinator.h" 21 #include "components/offline_pages/background/request_coordinator.h"
21 #include "components/offline_pages/background/save_page_request.h" 22 #include "components/offline_pages/background/save_page_request.h"
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 } 330 }
330 331
331 void OfflineInternalsUIMessageHandler::HandleAddToRequestQueue( 332 void OfflineInternalsUIMessageHandler::HandleAddToRequestQueue(
332 const base::ListValue* args) { 333 const base::ListValue* args) {
333 const base::Value* callback_id; 334 const base::Value* callback_id;
334 CHECK(args->Get(0, &callback_id)); 335 CHECK(args->Get(0, &callback_id));
335 336
336 std::string url; 337 std::string url;
337 CHECK(args->GetString(1, &url)); 338 CHECK(args->GetString(1, &url));
338 339
340 // To be visible in Downloads UI, these items need a well-formed GUILD
chili 2016/07/27 18:40:47 nit: should this say "GUI ID"? or "GUID"?
Dmitry Titov 2016/07/27 19:50:49 Done.
341 // and AsyncNamespace in their ClientId.
339 std::ostringstream id_stream; 342 std::ostringstream id_stream;
340 id_stream << std::rand(); 343 id_stream << base::GenerateGUID();
341 344
342 ResolveJavascriptCallback( 345 ResolveJavascriptCallback(
343 *callback_id, 346 *callback_id,
344 base::FundamentalValue( 347 base::FundamentalValue(
345 request_coordinator_->SavePageLater( 348 request_coordinator_->SavePageLater(
346 GURL(url), 349 GURL(url),
347 offline_pages::ClientId(offline_pages::kAsyncNamespace, 350 offline_pages::ClientId(offline_pages::kAsyncNamespace,
348 id_stream.str()), 351 id_stream.str()),
349 true))); 352 true)));
350 } 353 }
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 html_source->AddResourcePath("offline_internals_browser_proxy.js", 419 html_source->AddResourcePath("offline_internals_browser_proxy.js",
417 IDR_OFFLINE_INTERNALS_BROWSER_PROXY_JS); 420 IDR_OFFLINE_INTERNALS_BROWSER_PROXY_JS);
418 html_source->SetDefaultResource(IDR_OFFLINE_INTERNALS_HTML); 421 html_source->SetDefaultResource(IDR_OFFLINE_INTERNALS_HTML);
419 422
420 content::WebUIDataSource::Add(Profile::FromWebUI(web_ui), html_source); 423 content::WebUIDataSource::Add(Profile::FromWebUI(web_ui), html_source);
421 424
422 web_ui->AddMessageHandler(new OfflineInternalsUIMessageHandler()); 425 web_ui->AddMessageHandler(new OfflineInternalsUIMessageHandler());
423 } 426 }
424 427
425 OfflineInternalsUI::~OfflineInternalsUI() {} 428 OfflineInternalsUI::~OfflineInternalsUI() {}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698