| 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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 | 109 |
| 110 DictionaryValue* result = new DictionaryValue(); | 110 DictionaryValue* result = new DictionaryValue(); |
| 111 result->SetInteger(keys::kIdKey, ExtensionTabUtil::GetTabId(contents)); | 111 result->SetInteger(keys::kIdKey, ExtensionTabUtil::GetTabId(contents)); |
| 112 result->SetInteger(keys::kIndexKey, tab_index); | 112 result->SetInteger(keys::kIndexKey, tab_index); |
| 113 result->SetInteger(keys::kWindowIdKey, | 113 result->SetInteger(keys::kWindowIdKey, |
| 114 ExtensionTabUtil::GetWindowIdOfTab(contents)); | 114 ExtensionTabUtil::GetWindowIdOfTab(contents)); |
| 115 result->SetString(keys::kUrlKey, contents->GetURL().spec()); | 115 result->SetString(keys::kUrlKey, contents->GetURL().spec()); |
| 116 result->SetString(keys::kStatusKey, GetTabStatusText(status)); | 116 result->SetString(keys::kStatusKey, GetTabStatusText(status)); |
| 117 result->SetBoolean(keys::kSelectedKey, | 117 result->SetBoolean(keys::kSelectedKey, |
| 118 tab_strip && tab_index == tab_strip->selected_index()); | 118 tab_strip && tab_index == tab_strip->selected_index()); |
| 119 result->SetString(keys::kTitleKey, UTF16ToWide(contents->GetTitle())); |
| 119 | 120 |
| 120 if (status != TAB_LOADING) { | 121 if (status != TAB_LOADING) { |
| 121 result->SetString(keys::kTitleKey, UTF16ToWide(contents->GetTitle())); | |
| 122 | |
| 123 NavigationEntry* entry = contents->controller().GetActiveEntry(); | 122 NavigationEntry* entry = contents->controller().GetActiveEntry(); |
| 124 if (entry) { | 123 if (entry) { |
| 125 if (entry->favicon().is_valid()) | 124 if (entry->favicon().is_valid()) |
| 126 result->SetString(keys::kFavIconUrlKey, entry->favicon().url().spec()); | 125 result->SetString(keys::kFavIconUrlKey, entry->favicon().url().spec()); |
| 127 } | 126 } |
| 128 } | 127 } |
| 129 | 128 |
| 130 return result; | 129 return result; |
| 131 } | 130 } |
| 132 | 131 |
| (...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 868 if (ExtensionTabUtil::GetTabById(tab_id, profile, browser, tab_strip, | 867 if (ExtensionTabUtil::GetTabById(tab_id, profile, browser, tab_strip, |
| 869 contents, tab_index)) | 868 contents, tab_index)) |
| 870 return true; | 869 return true; |
| 871 | 870 |
| 872 if (error_message) | 871 if (error_message) |
| 873 *error_message = ExtensionErrorUtils::FormatErrorMessage( | 872 *error_message = ExtensionErrorUtils::FormatErrorMessage( |
| 874 keys::kTabNotFoundError, IntToString(tab_id)); | 873 keys::kTabNotFoundError, IntToString(tab_id)); |
| 875 | 874 |
| 876 return false; | 875 return false; |
| 877 } | 876 } |
| OLD | NEW |