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/ui/panels/panel.h" | 5 #include "chrome/browser/ui/panels/panel.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "chrome/app/chrome_command_ids.h" | 10 #include "chrome/app/chrome_command_ids.h" |
11 #include "chrome/browser/chrome_notification_types.h" | 11 #include "chrome/browser/chrome_notification_types.h" |
12 #include "chrome/browser/devtools/devtools_window.h" | 12 #include "chrome/browser/devtools/devtools_window.h" |
13 #include "chrome/browser/extensions/api/tabs/tabs_constants.h" | 13 #include "chrome/browser/extensions/api/tabs/tabs_constants.h" |
14 #include "chrome/browser/extensions/api/tabs/tabs_windows_api.h" | 14 #include "chrome/browser/extensions/api/tabs/tabs_windows_api.h" |
15 #include "chrome/browser/extensions/api/tabs/windows_event_router.h" | 15 #include "chrome/browser/extensions/api/tabs/windows_event_router.h" |
16 #include "chrome/browser/extensions/extension_service.h" | 16 #include "chrome/browser/extensions/extension_service.h" |
17 #include "chrome/browser/extensions/extension_tab_util.h" | 17 #include "chrome/browser/extensions/extension_tab_util.h" |
18 #include "chrome/browser/extensions/window_controller.h" | 18 #include "chrome/browser/extensions/window_controller.h" |
19 #include "chrome/browser/extensions/window_controller_list.h" | 19 #include "chrome/browser/extensions/window_controller_list.h" |
20 #include "chrome/browser/lifetime/application_lifetime.h" | 20 #include "chrome/browser/lifetime/application_lifetime.h" |
21 #include "chrome/browser/profiles/profile.h" | 21 #include "chrome/browser/profiles/profile.h" |
| 22 #include "chrome/browser/sessions/session_tab_helper.h" |
22 #include "chrome/browser/themes/theme_service.h" | 23 #include "chrome/browser/themes/theme_service.h" |
23 #include "chrome/browser/themes/theme_service_factory.h" | 24 #include "chrome/browser/themes/theme_service_factory.h" |
24 #include "chrome/browser/ui/panels/native_panel.h" | 25 #include "chrome/browser/ui/panels/native_panel.h" |
25 #include "chrome/browser/ui/panels/panel_collection.h" | 26 #include "chrome/browser/ui/panels/panel_collection.h" |
26 #include "chrome/browser/ui/panels/panel_host.h" | 27 #include "chrome/browser/ui/panels/panel_host.h" |
27 #include "chrome/browser/ui/panels/panel_manager.h" | 28 #include "chrome/browser/ui/panels/panel_manager.h" |
28 #include "chrome/browser/ui/panels/stacked_panel_collection.h" | 29 #include "chrome/browser/ui/panels/stacked_panel_collection.h" |
29 #include "chrome/browser/web_applications/web_app.h" | 30 #include "chrome/browser/web_applications/web_app.h" |
30 #include "content/public/browser/notification_service.h" | 31 #include "content/public/browser/notification_service.h" |
31 #include "content/public/browser/notification_source.h" | 32 #include "content/public/browser/notification_source.h" |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 if (tab_index > 0) | 109 if (tab_index > 0) |
109 return NULL; | 110 return NULL; |
110 | 111 |
111 content::WebContents* web_contents = panel_->GetWebContents(); | 112 content::WebContents* web_contents = panel_->GetWebContents(); |
112 if (!web_contents) | 113 if (!web_contents) |
113 return NULL; | 114 return NULL; |
114 | 115 |
115 DCHECK(IsVisibleToExtension(extension)); | 116 DCHECK(IsVisibleToExtension(extension)); |
116 base::DictionaryValue* tab_value = new base::DictionaryValue(); | 117 base::DictionaryValue* tab_value = new base::DictionaryValue(); |
117 tab_value->SetInteger(extensions::tabs_constants::kIdKey, | 118 tab_value->SetInteger(extensions::tabs_constants::kIdKey, |
118 SessionID::IdForTab(web_contents)); | 119 SessionTabHelper::IdForTab(web_contents)); |
119 tab_value->SetInteger(extensions::tabs_constants::kIndexKey, 0); | 120 tab_value->SetInteger(extensions::tabs_constants::kIndexKey, 0); |
120 tab_value->SetInteger(extensions::tabs_constants::kWindowIdKey, | 121 tab_value->SetInteger( |
121 SessionID::IdForWindowContainingTab(web_contents)); | 122 extensions::tabs_constants::kWindowIdKey, |
| 123 SessionTabHelper::IdForWindowContainingTab(web_contents)); |
122 tab_value->SetString( | 124 tab_value->SetString( |
123 extensions::tabs_constants::kUrlKey, web_contents->GetURL().spec()); | 125 extensions::tabs_constants::kUrlKey, web_contents->GetURL().spec()); |
124 tab_value->SetString(extensions::tabs_constants::kStatusKey, | 126 tab_value->SetString(extensions::tabs_constants::kStatusKey, |
125 extensions::ExtensionTabUtil::GetTabStatusText( | 127 extensions::ExtensionTabUtil::GetTabStatusText( |
126 web_contents->IsLoading())); | 128 web_contents->IsLoading())); |
127 tab_value->SetBoolean( | 129 tab_value->SetBoolean( |
128 extensions::tabs_constants::kActiveKey, panel_->IsActive()); | 130 extensions::tabs_constants::kActiveKey, panel_->IsActive()); |
129 tab_value->SetBoolean(extensions::tabs_constants::kSelectedKey, true); | 131 tab_value->SetBoolean(extensions::tabs_constants::kSelectedKey, true); |
130 tab_value->SetBoolean(extensions::tabs_constants::kHighlightedKey, true); | 132 tab_value->SetBoolean(extensions::tabs_constants::kHighlightedKey, true); |
131 tab_value->SetBoolean(extensions::tabs_constants::kPinnedKey, false); | 133 tab_value->SetBoolean(extensions::tabs_constants::kPinnedKey, false); |
(...skipping 761 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
893 // static | 895 // static |
894 void Panel::FormatTitleForDisplay(base::string16* title) { | 896 void Panel::FormatTitleForDisplay(base::string16* title) { |
895 size_t current_index = 0; | 897 size_t current_index = 0; |
896 size_t match_index; | 898 size_t match_index; |
897 while ((match_index = title->find(L'\n', current_index)) != | 899 while ((match_index = title->find(L'\n', current_index)) != |
898 base::string16::npos) { | 900 base::string16::npos) { |
899 title->replace(match_index, 1, base::string16()); | 901 title->replace(match_index, 1, base::string16()); |
900 current_index = match_index; | 902 current_index = match_index; |
901 } | 903 } |
902 } | 904 } |
OLD | NEW |