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

Side by Side Diff: chrome/browser/extensions/api/tabs/tabs_api.cc

Issue 2166523003: Add ref count to service workers for extension API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/extensions/api/tabs/tabs_api.h" 5 #include "chrome/browser/extensions/api/tabs/tabs_api.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <algorithm> 8 #include <algorithm>
9 #include <limits> 9 #include <limits>
10 #include <memory> 10 #include <memory>
(...skipping 1382 matching lines...) Expand 10 before | Expand all | Expand 10 after
1393 } 1393 }
1394 1394
1395 web_contents_->GetController().LoadURL( 1395 web_contents_->GetController().LoadURL(
1396 url, content::Referrer(), ui::PAGE_TRANSITION_LINK, std::string()); 1396 url, content::Referrer(), ui::PAGE_TRANSITION_LINK, std::string());
1397 1397
1398 // The URL of a tab contents never actually changes to a JavaScript URL, so 1398 // The URL of a tab contents never actually changes to a JavaScript URL, so
1399 // this check only makes sense in other cases. 1399 // this check only makes sense in other cases.
1400 if (!url.SchemeIs(url::kJavaScriptScheme)) 1400 if (!url.SchemeIs(url::kJavaScriptScheme))
1401 DCHECK_EQ(url.spec(), web_contents_->GetURL().spec()); 1401 DCHECK_EQ(url.spec(), web_contents_->GetURL().spec());
1402 1402
1403 // Add a fake delay add async behavior (and delay) to chrome.tabs.update().
1404 *is_async = true;
1405 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
1406 FROM_HERE, base::Bind(&TabsUpdateFunction::AfterFakeAsyncDelay, this),
1407 base::TimeDelta::FromSeconds(7));
1403 return true; 1408 return true;
1404 } 1409 }
1405 1410
1411 void TabsUpdateFunction::AfterFakeAsyncDelay() {
1412 LOG(ERROR) << "chrome.tabs.update: AfterFakeAsyncDelay fired";
1413 SendResponse(true);
1414 }
1415
1406 void TabsUpdateFunction::PopulateResult() { 1416 void TabsUpdateFunction::PopulateResult() {
1407 if (!has_callback()) 1417 if (!has_callback())
1408 return; 1418 return;
1409 1419
1410 results_ = tabs::Get::Results::Create( 1420 results_ = tabs::Get::Results::Create(
1411 *ExtensionTabUtil::CreateTabObject(web_contents_, extension())); 1421 *ExtensionTabUtil::CreateTabObject(web_contents_, extension()));
1412 } 1422 }
1413 1423
1414 void TabsUpdateFunction::OnExecuteCodeFinished( 1424 void TabsUpdateFunction::OnExecuteCodeFinished(
1415 const std::string& error, 1425 const std::string& error,
(...skipping 746 matching lines...) Expand 10 before | Expand all | Expand 10 after
2162 ZoomModeToZoomSettings(zoom_mode, &zoom_settings); 2172 ZoomModeToZoomSettings(zoom_mode, &zoom_settings);
2163 zoom_settings.default_zoom_factor.reset(new double( 2173 zoom_settings.default_zoom_factor.reset(new double(
2164 content::ZoomLevelToZoomFactor(zoom_controller->GetDefaultZoomLevel()))); 2174 content::ZoomLevelToZoomFactor(zoom_controller->GetDefaultZoomLevel())));
2165 2175
2166 results_ = api::tabs::GetZoomSettings::Results::Create(zoom_settings); 2176 results_ = api::tabs::GetZoomSettings::Results::Create(zoom_settings);
2167 SendResponse(true); 2177 SendResponse(true);
2168 return true; 2178 return true;
2169 } 2179 }
2170 2180
2171 } // namespace extensions 2181 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698