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 <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 921 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
932 } | 932 } |
933 | 933 |
934 TabStripModel* tab_strip = browser->tab_strip_model(); | 934 TabStripModel* tab_strip = browser->tab_strip_model(); |
935 for (int i = 0; i < tab_strip->count(); ++i) { | 935 for (int i = 0; i < tab_strip->count(); ++i) { |
936 WebContents* web_contents = tab_strip->GetWebContentsAt(i); | 936 WebContents* web_contents = tab_strip->GetWebContentsAt(i); |
937 memory::TabManager* tab_manager = g_browser_process->GetTabManager(); | 937 memory::TabManager* tab_manager = g_browser_process->GetTabManager(); |
938 | 938 |
939 if (index > -1 && i != index) | 939 if (index > -1 && i != index) |
940 continue; | 940 continue; |
941 | 941 |
| 942 if (!web_contents) { |
| 943 continue; |
| 944 } |
| 945 |
942 if (!MatchesBool(params->query_info.highlighted.get(), | 946 if (!MatchesBool(params->query_info.highlighted.get(), |
943 tab_strip->IsTabSelected(i))) { | 947 tab_strip->IsTabSelected(i))) { |
944 continue; | 948 continue; |
945 } | 949 } |
946 | 950 |
947 if (!MatchesBool(params->query_info.active.get(), | 951 if (!MatchesBool(params->query_info.active.get(), |
948 i == tab_strip->active_index())) { | 952 i == tab_strip->active_index())) { |
949 continue; | 953 continue; |
950 } | 954 } |
951 | 955 |
(...skipping 1193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2145 params->tab_id | 2149 params->tab_id |
2146 ? ErrorUtils::FormatErrorMessage(keys::kCannotDiscardTab, | 2150 ? ErrorUtils::FormatErrorMessage(keys::kCannotDiscardTab, |
2147 base::IntToString(*params->tab_id)) | 2151 base::IntToString(*params->tab_id)) |
2148 : keys::kCannotFindTabToDiscard)); | 2152 : keys::kCannotFindTabToDiscard)); |
2149 } | 2153 } |
2150 | 2154 |
2151 TabsDiscardFunction::TabsDiscardFunction() {} | 2155 TabsDiscardFunction::TabsDiscardFunction() {} |
2152 TabsDiscardFunction::~TabsDiscardFunction() {} | 2156 TabsDiscardFunction::~TabsDiscardFunction() {} |
2153 | 2157 |
2154 } // namespace extensions | 2158 } // namespace extensions |
OLD | NEW |