| 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_api.h" | 5 #include "chrome/browser/extensions/api/tabs/tabs_api.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/bind.h" | 11 #include "base/bind.h" |
| 12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 13 #include "base/location.h" | 13 #include "base/location.h" |
| 14 #include "base/logging.h" | 14 #include "base/logging.h" |
| 15 #include "base/memory/ref_counted_memory.h" | 15 #include "base/memory/ref_counted_memory.h" |
| 16 #include "base/prefs/pref_service.h" | 16 #include "base/prefs/pref_service.h" |
| 17 #include "base/single_thread_task_runner.h" | 17 #include "base/single_thread_task_runner.h" |
| 18 #include "base/stl_util.h" | 18 #include "base/stl_util.h" |
| 19 #include "base/strings/pattern.h" |
| 19 #include "base/strings/string16.h" | 20 #include "base/strings/string16.h" |
| 20 #include "base/strings/string_number_conversions.h" | 21 #include "base/strings/string_number_conversions.h" |
| 21 #include "base/strings/string_util.h" | 22 #include "base/strings/string_util.h" |
| 22 #include "base/strings/utf_string_conversions.h" | 23 #include "base/strings/utf_string_conversions.h" |
| 23 #include "base/thread_task_runner_handle.h" | 24 #include "base/thread_task_runner_handle.h" |
| 24 #include "chrome/browser/apps/scoped_keep_alive.h" | 25 #include "chrome/browser/apps/scoped_keep_alive.h" |
| 25 #include "chrome/browser/chrome_notification_types.h" | 26 #include "chrome/browser/chrome_notification_types.h" |
| 26 #include "chrome/browser/extensions/api/tabs/tabs_constants.h" | 27 #include "chrome/browser/extensions/api/tabs/tabs_constants.h" |
| 27 #include "chrome/browser/extensions/api/tabs/windows_util.h" | 28 #include "chrome/browser/extensions/api/tabs/windows_util.h" |
| 28 #include "chrome/browser/extensions/extension_service.h" | 29 #include "chrome/browser/extensions/extension_service.h" |
| (...skipping 915 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 944 if (!MatchesBool(params->query_info.active.get(), | 945 if (!MatchesBool(params->query_info.active.get(), |
| 945 i == tab_strip->active_index())) { | 946 i == tab_strip->active_index())) { |
| 946 continue; | 947 continue; |
| 947 } | 948 } |
| 948 | 949 |
| 949 if (!MatchesBool(params->query_info.pinned.get(), | 950 if (!MatchesBool(params->query_info.pinned.get(), |
| 950 tab_strip->IsTabPinned(i))) { | 951 tab_strip->IsTabPinned(i))) { |
| 951 continue; | 952 continue; |
| 952 } | 953 } |
| 953 | 954 |
| 954 if (!title.empty() && !MatchPattern(web_contents->GetTitle(), | 955 if (!title.empty() && !base::MatchPattern(web_contents->GetTitle(), |
| 955 base::UTF8ToUTF16(title))) | 956 base::UTF8ToUTF16(title))) |
| 956 continue; | 957 continue; |
| 957 | 958 |
| 958 if (!url_patterns.is_empty() && | 959 if (!url_patterns.is_empty() && |
| 959 !url_patterns.MatchesURL(web_contents->GetURL())) | 960 !url_patterns.MatchesURL(web_contents->GetURL())) |
| 960 continue; | 961 continue; |
| 961 | 962 |
| 962 if (loading_status_set && loading != web_contents->IsLoading()) | 963 if (loading_status_set && loading != web_contents->IsLoading()) |
| 963 continue; | 964 continue; |
| 964 | 965 |
| 965 result->Append(ExtensionTabUtil::CreateTabValue( | 966 result->Append(ExtensionTabUtil::CreateTabValue( |
| (...skipping 1026 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1992 ZoomModeToZoomSettings(zoom_mode, &zoom_settings); | 1993 ZoomModeToZoomSettings(zoom_mode, &zoom_settings); |
| 1993 zoom_settings.default_zoom_factor.reset(new double( | 1994 zoom_settings.default_zoom_factor.reset(new double( |
| 1994 content::ZoomLevelToZoomFactor(zoom_controller->GetDefaultZoomLevel()))); | 1995 content::ZoomLevelToZoomFactor(zoom_controller->GetDefaultZoomLevel()))); |
| 1995 | 1996 |
| 1996 results_ = api::tabs::GetZoomSettings::Results::Create(zoom_settings); | 1997 results_ = api::tabs::GetZoomSettings::Results::Create(zoom_settings); |
| 1997 SendResponse(true); | 1998 SendResponse(true); |
| 1998 return true; | 1999 return true; |
| 1999 } | 2000 } |
| 2000 | 2001 |
| 2001 } // namespace extensions | 2002 } // namespace extensions |
| OLD | NEW |