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

Unified Diff: chrome/browser/extensions/api/tabs/windows_util.cc

Issue 1099553002: extensions: windows: list all windows from the current profile (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nit Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/extensions/api/tabs/windows_util.h ('k') | chrome/browser/extensions/extension_tab_util.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/api/tabs/windows_util.cc
diff --git a/chrome/browser/extensions/api/tabs/windows_util.cc b/chrome/browser/extensions/api/tabs/windows_util.cc
index 0e2ead5b3e8b9c70018413ae476d90e05c3c2f49..56830c984d14814de6cb34eb8931f20fe873fb6d 100644
--- a/chrome/browser/extensions/api/tabs/windows_util.cc
+++ b/chrome/browser/extensions/api/tabs/windows_util.cc
@@ -2,12 +2,16 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include <string>
+#include <vector>
+
#include "chrome/browser/extensions/api/tabs/windows_util.h"
#include "base/strings/string_number_conversions.h"
#include "chrome/browser/extensions/api/tabs/tabs_constants.h"
#include "chrome/browser/extensions/chrome_extension_function.h"
#include "chrome/browser/extensions/chrome_extension_function_details.h"
+#include "chrome/browser/extensions/extension_util.h"
#include "chrome/browser/extensions/window_controller.h"
#include "chrome/browser/extensions/window_controller_list.h"
#include "chrome/browser/profiles/profile.h"
@@ -15,11 +19,13 @@
#include "extensions/browser/extension_function_dispatcher.h"
#include "extensions/common/constants.h"
#include "extensions/common/error_utils.h"
+#include "extensions/common/extension.h"
namespace windows_util {
bool GetWindowFromWindowID(UIThreadExtensionFunction* function,
int window_id,
+ extensions::WindowController::TypeFilter filter,
extensions::WindowController** controller) {
if (window_id == extension_misc::kCurrentWindowId) {
extensions::WindowController* extension_window_controller =
@@ -37,8 +43,9 @@ bool GetWindowFromWindowID(UIThreadExtensionFunction* function,
return false;
}
} else {
- *controller = extensions::WindowControllerList::GetInstance()
- ->FindWindowForFunctionById(function, window_id);
+ *controller =
+ extensions::WindowControllerList::GetInstance()
+ ->FindWindowForFunctionByIdWithFilter(function, window_id, filter);
if (!(*controller)) {
function->SetError(extensions::ErrorUtils::FormatErrorMessage(
extensions::tabs_constants::kWindowNotFoundError,
@@ -50,11 +57,10 @@ bool GetWindowFromWindowID(UIThreadExtensionFunction* function,
}
bool CanOperateOnWindow(const UIThreadExtensionFunction* function,
- const extensions::WindowController* controller) {
- if (function->extension() != NULL &&
- !controller->IsVisibleToExtension(function->extension())) {
+ const extensions::WindowController* controller,
+ extensions::WindowController::TypeFilter filter) {
+ if (!controller->MatchesFilter(filter))
return false;
- }
if (function->browser_context() == controller->profile())
return true;
« no previous file with comments | « chrome/browser/extensions/api/tabs/windows_util.h ('k') | chrome/browser/extensions/extension_tab_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698