OLD | NEW |
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.h" | 5 #include "chrome/browser/extensions/api/tabs/tabs.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 GetLastFocused::Params::Create(*args_)); | 293 GetLastFocused::Params::Create(*args_)); |
294 EXTENSION_FUNCTION_VALIDATE(params.get()); | 294 EXTENSION_FUNCTION_VALIDATE(params.get()); |
295 | 295 |
296 bool populate_tabs = false; | 296 bool populate_tabs = false; |
297 if (params->get_info.get() && params->get_info->populate.get()) | 297 if (params->get_info.get() && params->get_info->populate.get()) |
298 populate_tabs = *params->get_info->populate; | 298 populate_tabs = *params->get_info->populate; |
299 | 299 |
300 // Note: currently this returns the last active browser. If we decide to | 300 // Note: currently this returns the last active browser. If we decide to |
301 // include other window types (e.g. panels), we will need to add logic to | 301 // include other window types (e.g. panels), we will need to add logic to |
302 // WindowControllerList that mirrors the active behavior of BrowserList. | 302 // WindowControllerList that mirrors the active behavior of BrowserList. |
303 Browser* browser = browser::FindAnyBrowser( | 303 Browser* browser = chrome::FindAnyBrowser( |
304 profile(), include_incognito(), chrome::GetActiveDesktop()); | 304 profile(), include_incognito(), chrome::GetActiveDesktop()); |
305 if (!browser || !browser->window()) { | 305 if (!browser || !browser->window()) { |
306 error_ = keys::kNoLastFocusedWindowError; | 306 error_ = keys::kNoLastFocusedWindowError; |
307 return false; | 307 return false; |
308 } | 308 } |
309 WindowController* controller = | 309 WindowController* controller = |
310 browser->extension_window_controller(); | 310 browser->extension_window_controller(); |
311 if (populate_tabs) | 311 if (populate_tabs) |
312 SetResult(controller->CreateWindowValueWithTabs(GetExtension())); | 312 SetResult(controller->CreateWindowValueWithTabs(GetExtension())); |
313 else | 313 else |
(...skipping 1560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1874 // called for every API call the extension made. | 1874 // called for every API call the extension made. |
1875 GotLanguage(language); | 1875 GotLanguage(language); |
1876 } | 1876 } |
1877 | 1877 |
1878 void DetectTabLanguageFunction::GotLanguage(const std::string& language) { | 1878 void DetectTabLanguageFunction::GotLanguage(const std::string& language) { |
1879 SetResult(Value::CreateStringValue(language.c_str())); | 1879 SetResult(Value::CreateStringValue(language.c_str())); |
1880 SendResponse(true); | 1880 SendResponse(true); |
1881 | 1881 |
1882 Release(); // Balanced in Run() | 1882 Release(); // Balanced in Run() |
1883 } | 1883 } |
OLD | NEW |