OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/extension_tabs_module.h" | 5 #include "chrome/browser/extensions/extension_tabs_module.h" |
6 | 6 |
7 #include "base/gfx/jpeg_codec.h" | 7 #include "base/gfx/jpeg_codec.h" |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
9 #include "chrome/browser/browser.h" | 9 #include "chrome/browser/browser.h" |
10 #include "chrome/browser/browser_list.h" | 10 #include "chrome/browser/browser_list.h" |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 | 108 |
109 DictionaryValue* result = new DictionaryValue(); | 109 DictionaryValue* result = new DictionaryValue(); |
110 result->SetInteger(keys::kIdKey, ExtensionTabUtil::GetTabId(contents)); | 110 result->SetInteger(keys::kIdKey, ExtensionTabUtil::GetTabId(contents)); |
111 result->SetInteger(keys::kIndexKey, tab_index); | 111 result->SetInteger(keys::kIndexKey, tab_index); |
112 result->SetInteger(keys::kWindowIdKey, | 112 result->SetInteger(keys::kWindowIdKey, |
113 ExtensionTabUtil::GetWindowIdOfTab(contents)); | 113 ExtensionTabUtil::GetWindowIdOfTab(contents)); |
114 result->SetString(keys::kUrlKey, contents->GetURL().spec()); | 114 result->SetString(keys::kUrlKey, contents->GetURL().spec()); |
115 result->SetString(keys::kStatusKey, GetTabStatusText(status)); | 115 result->SetString(keys::kStatusKey, GetTabStatusText(status)); |
116 result->SetBoolean(keys::kSelectedKey, | 116 result->SetBoolean(keys::kSelectedKey, |
117 tab_strip && tab_index == tab_strip->selected_index()); | 117 tab_strip && tab_index == tab_strip->selected_index()); |
118 result->SetString(keys::kTitleKey, UTF16ToWide(contents->GetTitle())); | |
119 | 118 |
120 if (status != TAB_LOADING) { | 119 if (status != TAB_LOADING) { |
| 120 result->SetString(keys::kTitleKey, UTF16ToWide(contents->GetTitle())); |
| 121 |
121 NavigationEntry* entry = contents->controller().GetActiveEntry(); | 122 NavigationEntry* entry = contents->controller().GetActiveEntry(); |
122 if (entry) { | 123 if (entry) { |
123 if (entry->favicon().is_valid()) | 124 if (entry->favicon().is_valid()) |
124 result->SetString(keys::kFavIconUrlKey, entry->favicon().url().spec()); | 125 result->SetString(keys::kFavIconUrlKey, entry->favicon().url().spec()); |
125 } | 126 } |
126 } | 127 } |
127 | 128 |
128 return result; | 129 return result; |
129 } | 130 } |
130 | 131 |
(...skipping 756 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
887 if (ExtensionTabUtil::GetTabById(tab_id, profile, browser, tab_strip, | 888 if (ExtensionTabUtil::GetTabById(tab_id, profile, browser, tab_strip, |
888 contents, tab_index)) | 889 contents, tab_index)) |
889 return true; | 890 return true; |
890 | 891 |
891 if (error_message) | 892 if (error_message) |
892 *error_message = ExtensionErrorUtils::FormatErrorMessage( | 893 *error_message = ExtensionErrorUtils::FormatErrorMessage( |
893 keys::kTabNotFoundError, IntToString(tab_id)); | 894 keys::kTabNotFoundError, IntToString(tab_id)); |
894 | 895 |
895 return false; | 896 return false; |
896 } | 897 } |
OLD | NEW |