OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/profiles/profile.h" | 5 #include "chrome/browser/profiles/profile.h" |
6 #include "chrome/browser/extensions/extension_tab_util.h" | 6 #include "chrome/browser/extensions/extension_tab_util.h" |
7 #include "chrome/browser/ui/browser.h" | 7 #include "chrome/browser/ui/browser.h" |
8 #include "chrome/browser/tabs/tab_strip_model.h" | 8 #include "chrome/browser/tabs/tab_strip_model.h" |
9 #include "content/browser/tab_contents/tab_contents.h" | 9 #include "content/browser/tab_contents/tab_contents.h" |
10 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 10 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
11 #include "chrome/browser/ui/browser_window.h" | 11 #include "chrome/browser/ui/browser_window.h" |
12 #include "chrome/browser/ui/browser_list.h" | 12 #include "chrome/browser/ui/browser_list.h" |
13 #include "chrome/browser/sessions/restore_tab_helper.h" | 13 #include "chrome/browser/sessions/restore_tab_helper.h" |
14 #include "chrome/browser/extensions/extension_tabs_module_constants.h" | 14 #include "chrome/browser/extensions/extension_tabs_module_constants.h" |
15 #include "content/public/browser/favicon_status.h" | 15 #include "content/public/browser/favicon_status.h" |
16 #include "content/public/browser/navigation_entry.h" | 16 #include "content/public/browser/navigation_entry.h" |
17 | 17 |
18 namespace keys = extension_tabs_module_constants; | 18 namespace keys = extension_tabs_module_constants; |
19 namespace errors = extension_manifest_errors; | 19 namespace errors = extension_manifest_errors; |
20 | 20 |
| 21 using content::NavigationEntry; |
21 using content::WebContents; | 22 using content::WebContents; |
22 | 23 |
23 int ExtensionTabUtil::GetWindowId(const Browser* browser) { | 24 int ExtensionTabUtil::GetWindowId(const Browser* browser) { |
24 return browser->session_id().id(); | 25 return browser->session_id().id(); |
25 } | 26 } |
26 | 27 |
27 int ExtensionTabUtil::GetWindowIdOfTabStripModel( | 28 int ExtensionTabUtil::GetWindowIdOfTabStripModel( |
28 const TabStripModel* tab_strip_model) { | 29 const TabStripModel* tab_strip_model) { |
29 for (BrowserList::const_iterator it = BrowserList::begin(); | 30 for (BrowserList::const_iterator it = BrowserList::begin(); |
30 it != BrowserList::end(); ++it) { | 31 it != BrowserList::end(); ++it) { |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 tab_strip && tab_index == tab_strip->active_index()); | 113 tab_strip && tab_index == tab_strip->active_index()); |
113 result->SetBoolean(keys::kHighlightedKey, | 114 result->SetBoolean(keys::kHighlightedKey, |
114 tab_strip && tab_strip->IsTabSelected(tab_index)); | 115 tab_strip && tab_strip->IsTabSelected(tab_index)); |
115 result->SetBoolean(keys::kPinnedKey, | 116 result->SetBoolean(keys::kPinnedKey, |
116 tab_strip && tab_strip->IsTabPinned(tab_index)); | 117 tab_strip && tab_strip->IsTabPinned(tab_index)); |
117 result->SetString(keys::kTitleKey, contents->GetTitle()); | 118 result->SetString(keys::kTitleKey, contents->GetTitle()); |
118 result->SetBoolean(keys::kIncognitoKey, | 119 result->SetBoolean(keys::kIncognitoKey, |
119 contents->GetBrowserContext()->IsOffTheRecord()); | 120 contents->GetBrowserContext()->IsOffTheRecord()); |
120 | 121 |
121 if (!is_loading) { | 122 if (!is_loading) { |
122 content::NavigationEntry* entry = | 123 NavigationEntry* entry = contents->GetController().GetActiveEntry(); |
123 contents->GetController().GetActiveEntry(); | |
124 if (entry) { | 124 if (entry) { |
125 if (entry->GetFavicon().valid) | 125 if (entry->GetFavicon().valid) |
126 result->SetString(keys::kFaviconUrlKey, entry->GetFavicon().url.spec()); | 126 result->SetString(keys::kFaviconUrlKey, entry->GetFavicon().url.spec()); |
127 } | 127 } |
128 } | 128 } |
129 | 129 |
130 return result; | 130 return result; |
131 } | 131 } |
132 | 132 |
133 DictionaryValue* ExtensionTabUtil::CreateTabValueActive( | 133 DictionaryValue* ExtensionTabUtil::CreateTabValueActive( |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 *contents = target_contents; | 235 *contents = target_contents; |
236 if (tab_index) | 236 if (tab_index) |
237 *tab_index = i; | 237 *tab_index = i; |
238 return true; | 238 return true; |
239 } | 239 } |
240 } | 240 } |
241 } | 241 } |
242 } | 242 } |
243 return false; | 243 return false; |
244 } | 244 } |
OLD | NEW |