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/extension_tab_util.h" | 5 #include "chrome/browser/extensions/extension_tab_util.h" |
6 | 6 |
7 #include "base/strings/string_number_conversions.h" | 7 #include "base/strings/string_number_conversions.h" |
8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
9 #include "chrome/browser/extensions/api/tabs/tabs_constants.h" | 9 #include "chrome/browser/extensions/api/tabs/tabs_constants.h" |
10 #include "chrome/browser/extensions/chrome_extension_function.h" | 10 #include "chrome/browser/extensions/chrome_extension_function.h" |
11 #include "chrome/browser/extensions/chrome_extension_function_details.h" | 11 #include "chrome/browser/extensions/chrome_extension_function_details.h" |
12 #include "chrome/browser/extensions/tab_helper.h" | 12 #include "chrome/browser/extensions/tab_helper.h" |
13 #include "chrome/browser/extensions/window_controller.h" | 13 #include "chrome/browser/extensions/window_controller.h" |
14 #include "chrome/browser/extensions/window_controller_list.h" | 14 #include "chrome/browser/extensions/window_controller_list.h" |
15 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
16 #include "chrome/browser/sessions/session_tab_helper.h" | 16 #include "chrome/browser/sessions/session_tab_helper.h" |
17 #include "chrome/browser/ui/browser.h" | 17 #include "chrome/browser/ui/browser.h" |
18 #include "chrome/browser/ui/browser_finder.h" | 18 #include "chrome/browser/ui/browser_finder.h" |
19 #include "chrome/browser/ui/browser_iterator.h" | 19 #include "chrome/browser/ui/browser_iterator.h" |
20 #include "chrome/browser/ui/browser_window.h" | 20 #include "chrome/browser/ui/browser_window.h" |
21 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" | 21 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" |
22 #include "chrome/browser/ui/singleton_tabs.h" | 22 #include "chrome/browser/ui/singleton_tabs.h" |
23 #include "chrome/browser/ui/tab_contents/tab_contents_iterator.h" | 23 #include "chrome/browser/ui/tab_contents/tab_contents_iterator.h" |
24 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 24 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 25 #include "chrome/browser/ui/tabs/tab_utils.h" |
25 #include "chrome/common/extensions/api/tabs.h" | 26 #include "chrome/common/extensions/api/tabs.h" |
26 #include "chrome/common/url_constants.h" | 27 #include "chrome/common/url_constants.h" |
27 #include "components/url_fixer/url_fixer.h" | 28 #include "components/url_fixer/url_fixer.h" |
28 #include "content/public/browser/favicon_status.h" | 29 #include "content/public/browser/favicon_status.h" |
29 #include "content/public/browser/navigation_entry.h" | 30 #include "content/public/browser/navigation_entry.h" |
30 #include "content/public/browser/web_contents.h" | 31 #include "content/public/browser/web_contents.h" |
31 #include "extensions/browser/app_window/app_window.h" | 32 #include "extensions/browser/app_window/app_window.h" |
32 #include "extensions/browser/app_window/app_window_registry.h" | 33 #include "extensions/browser/app_window/app_window_registry.h" |
33 #include "extensions/common/constants.h" | 34 #include "extensions/common/constants.h" |
34 #include "extensions/common/error_utils.h" | 35 #include "extensions/common/error_utils.h" |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
375 result->SetInteger(keys::kWindowIdKey, GetWindowIdOfTab(contents)); | 376 result->SetInteger(keys::kWindowIdKey, GetWindowIdOfTab(contents)); |
376 result->SetString(keys::kStatusKey, GetTabStatusText(is_loading)); | 377 result->SetString(keys::kStatusKey, GetTabStatusText(is_loading)); |
377 result->SetBoolean(keys::kActiveKey, | 378 result->SetBoolean(keys::kActiveKey, |
378 tab_strip && tab_index == tab_strip->active_index()); | 379 tab_strip && tab_index == tab_strip->active_index()); |
379 result->SetBoolean(keys::kSelectedKey, | 380 result->SetBoolean(keys::kSelectedKey, |
380 tab_strip && tab_index == tab_strip->active_index()); | 381 tab_strip && tab_index == tab_strip->active_index()); |
381 result->SetBoolean(keys::kHighlightedKey, | 382 result->SetBoolean(keys::kHighlightedKey, |
382 tab_strip && tab_strip->IsTabSelected(tab_index)); | 383 tab_strip && tab_strip->IsTabSelected(tab_index)); |
383 result->SetBoolean(keys::kPinnedKey, | 384 result->SetBoolean(keys::kPinnedKey, |
384 tab_strip && tab_strip->IsTabPinned(tab_index)); | 385 tab_strip && tab_strip->IsTabPinned(tab_index)); |
| 386 result->SetBoolean(keys::kAudibleKey, |
| 387 tab_strip && chrome::IsPlayingAudio(contents)); |
| 388 result->SetBoolean(keys::kMutedKey, |
| 389 tab_strip && chrome::IsTabAudioMuted(contents)); |
| 390 result->SetString(keys::kMutedCauseKey, |
| 391 chrome::GetTabAudioMutedCause(contents)); |
385 result->SetBoolean(keys::kIncognitoKey, | 392 result->SetBoolean(keys::kIncognitoKey, |
386 contents->GetBrowserContext()->IsOffTheRecord()); | 393 contents->GetBrowserContext()->IsOffTheRecord()); |
387 result->SetInteger(keys::kWidthKey, | 394 result->SetInteger(keys::kWidthKey, |
388 contents->GetContainerBounds().size().width()); | 395 contents->GetContainerBounds().size().width()); |
389 result->SetInteger(keys::kHeightKey, | 396 result->SetInteger(keys::kHeightKey, |
390 contents->GetContainerBounds().size().height()); | 397 contents->GetContainerBounds().size().height()); |
391 | 398 |
392 // Privacy-sensitive fields: these should be stripped off by | 399 // Privacy-sensitive fields: these should be stripped off by |
393 // ScrubTabValueForExtension if the extension should not see them. | 400 // ScrubTabValueForExtension if the extension should not see them. |
394 result->SetString(keys::kUrlKey, contents->GetURL().spec()); | 401 result->SetString(keys::kUrlKey, contents->GetURL().spec()); |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
616 browser->window()->Show(); | 623 browser->window()->Show(); |
617 WebContents* web_contents = | 624 WebContents* web_contents = |
618 browser->tab_strip_model()->GetActiveWebContents(); | 625 browser->tab_strip_model()->GetActiveWebContents(); |
619 web_contents->GetDelegate()->ActivateContents(web_contents); | 626 web_contents->GetDelegate()->ActivateContents(web_contents); |
620 } | 627 } |
621 | 628 |
622 return true; | 629 return true; |
623 } | 630 } |
624 | 631 |
625 } // namespace extensions | 632 } // namespace extensions |
OLD | NEW |