Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(266)

Side by Side Diff: chrome/browser/extensions/api/tabs/tabs_api.cc

Issue 987583004: Add audible, muted to Tab, c.t.query, c.t.update, and c.t.onUpdated where relevant (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@patch1
Patch Set: tests; also mutedCause is a part of the tab object and capture mutedCause changed to just 'capture' Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/api/tabs/tabs_api.h" 5 #include "chrome/browser/extensions/api/tabs/tabs_api.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 25 matching lines...) Expand all
36 #include "chrome/browser/ui/browser.h" 36 #include "chrome/browser/ui/browser.h"
37 #include "chrome/browser/ui/browser_commands.h" 37 #include "chrome/browser/ui/browser_commands.h"
38 #include "chrome/browser/ui/browser_finder.h" 38 #include "chrome/browser/ui/browser_finder.h"
39 #include "chrome/browser/ui/browser_iterator.h" 39 #include "chrome/browser/ui/browser_iterator.h"
40 #include "chrome/browser/ui/browser_navigator.h" 40 #include "chrome/browser/ui/browser_navigator.h"
41 #include "chrome/browser/ui/browser_tabstrip.h" 41 #include "chrome/browser/ui/browser_tabstrip.h"
42 #include "chrome/browser/ui/browser_window.h" 42 #include "chrome/browser/ui/browser_window.h"
43 #include "chrome/browser/ui/host_desktop.h" 43 #include "chrome/browser/ui/host_desktop.h"
44 #include "chrome/browser/ui/panels/panel_manager.h" 44 #include "chrome/browser/ui/panels/panel_manager.h"
45 #include "chrome/browser/ui/tabs/tab_strip_model.h" 45 #include "chrome/browser/ui/tabs/tab_strip_model.h"
46 #include "chrome/browser/ui/tabs/tab_utils.h"
46 #include "chrome/browser/ui/window_sizer/window_sizer.h" 47 #include "chrome/browser/ui/window_sizer/window_sizer.h"
47 #include "chrome/browser/web_applications/web_app.h" 48 #include "chrome/browser/web_applications/web_app.h"
48 #include "chrome/common/chrome_switches.h" 49 #include "chrome/common/chrome_switches.h"
49 #include "chrome/common/extensions/api/tabs.h" 50 #include "chrome/common/extensions/api/tabs.h"
50 #include "chrome/common/extensions/api/windows.h" 51 #include "chrome/common/extensions/api/windows.h"
51 #include "chrome/common/extensions/extension_constants.h" 52 #include "chrome/common/extensions/extension_constants.h"
52 #include "chrome/common/pref_names.h" 53 #include "chrome/common/pref_names.h"
53 #include "chrome/common/url_constants.h" 54 #include "chrome/common/url_constants.h"
54 #include "components/pref_registry/pref_registry_syncable.h" 55 #include "components/pref_registry/pref_registry_syncable.h"
55 #include "components/translate/core/browser/language_state.h" 56 #include "components/translate/core/browser/language_state.h"
(...skipping 845 matching lines...) Expand 10 before | Expand all | Expand 10 after
901 if (!MatchesBool(params->query_info.active.get(), 902 if (!MatchesBool(params->query_info.active.get(),
902 i == tab_strip->active_index())) { 903 i == tab_strip->active_index())) {
903 continue; 904 continue;
904 } 905 }
905 906
906 if (!MatchesBool(params->query_info.pinned.get(), 907 if (!MatchesBool(params->query_info.pinned.get(),
907 tab_strip->IsTabPinned(i))) { 908 tab_strip->IsTabPinned(i))) {
908 continue; 909 continue;
909 } 910 }
910 911
912 if (!MatchesBool(params->query_info.audible.get(),
913 chrome::IsPlayingAudio(web_contents))) {
914 continue;
915 }
916
917 if (!MatchesBool(params->query_info.muted.get(),
918 chrome::IsTabAudioMuted(web_contents))) {
919 continue;
920 }
921
911 if (!title.empty() && !MatchPattern(web_contents->GetTitle(), 922 if (!title.empty() && !MatchPattern(web_contents->GetTitle(),
912 base::UTF8ToUTF16(title))) 923 base::UTF8ToUTF16(title)))
913 continue; 924 continue;
914 925
915 if (!url_patterns.is_empty() && 926 if (!url_patterns.is_empty() &&
916 !url_patterns.MatchesURL(web_contents->GetURL())) 927 !url_patterns.MatchesURL(web_contents->GetURL()))
917 continue; 928 continue;
918 929
919 if (loading_status_set && loading != web_contents->IsLoading()) 930 if (loading_status_set && loading != web_contents->IsLoading())
920 continue; 931 continue;
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
1178 } 1189 }
1179 1190
1180 if (params->update_properties.pinned.get()) { 1191 if (params->update_properties.pinned.get()) {
1181 bool pinned = *params->update_properties.pinned; 1192 bool pinned = *params->update_properties.pinned;
1182 tab_strip->SetTabPinned(tab_index, pinned); 1193 tab_strip->SetTabPinned(tab_index, pinned);
1183 1194
1184 // Update the tab index because it may move when being pinned. 1195 // Update the tab index because it may move when being pinned.
1185 tab_index = tab_strip->GetIndexOfWebContents(contents); 1196 tab_index = tab_strip->GetIndexOfWebContents(contents);
1186 } 1197 }
1187 1198
1199 if (params->update_properties.muted.get()) {
1200 bool muted = *params->update_properties.muted;
not at google - send to devlin 2015/05/26 23:09:46 Could you make this (and I may have the names wron
Jared Sohn 2015/05/27 14:52:02 Done (after making a few changes including not nam
not at google - send to devlin 2015/05/28 23:04:42 Nah no need for a separate flag. I think the API c
miu 2015/05/28 23:36:59 It's designed to report whatever state the WebCont
not at google - send to devlin 2015/05/29 21:28:15 Awesome. In that case we should actually be able t
1201 chrome::SetTabAudioMuted(contents, muted, extension()->id());
1202 }
1203
1188 if (params->update_properties.opener_tab_id.get()) { 1204 if (params->update_properties.opener_tab_id.get()) {
1189 int opener_id = *params->update_properties.opener_tab_id; 1205 int opener_id = *params->update_properties.opener_tab_id;
1190 1206
1191 WebContents* opener_contents = NULL; 1207 WebContents* opener_contents = NULL;
1192 if (!ExtensionTabUtil::GetTabById(opener_id, 1208 if (!ExtensionTabUtil::GetTabById(opener_id,
1193 GetProfile(), 1209 GetProfile(),
1194 include_incognito(), 1210 include_incognito(),
1195 NULL, 1211 NULL,
1196 NULL, 1212 NULL,
1197 &opener_contents, 1213 &opener_contents,
(...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after
1951 ZoomController::ZoomMode zoom_mode = zoom_controller->zoom_mode(); 1967 ZoomController::ZoomMode zoom_mode = zoom_controller->zoom_mode();
1952 api::tabs::ZoomSettings zoom_settings; 1968 api::tabs::ZoomSettings zoom_settings;
1953 ZoomModeToZoomSettings(zoom_mode, &zoom_settings); 1969 ZoomModeToZoomSettings(zoom_mode, &zoom_settings);
1954 1970
1955 results_ = api::tabs::GetZoomSettings::Results::Create(zoom_settings); 1971 results_ = api::tabs::GetZoomSettings::Results::Create(zoom_settings);
1956 SendResponse(true); 1972 SendResponse(true);
1957 return true; 1973 return true;
1958 } 1974 }
1959 1975
1960 } // namespace extensions 1976 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698