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

Side by Side Diff: chrome/browser/extensions/api/tabs/ash_panel_contents.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: Add application windows resize constraint test Created 5 years, 6 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/ash_panel_contents.h" 5 #include "chrome/browser/extensions/api/tabs/ash_panel_contents.h"
6 6
7 #include "base/values.h" 7 #include "base/values.h"
8 #include "chrome/browser/chrome_notification_types.h" 8 #include "chrome/browser/chrome_notification_types.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/api/tabs/tabs_windows_api.h" 10 #include "chrome/browser/extensions/api/tabs/tabs_windows_api.h"
11 #include "chrome/browser/extensions/api/tabs/windows_event_router.h" 11 #include "chrome/browser/extensions/api/tabs/windows_event_router.h"
12 #include "chrome/browser/extensions/extension_tab_util.h" 12 #include "chrome/browser/extensions/extension_tab_util.h"
13 #include "chrome/browser/extensions/window_controller_list.h" 13 #include "chrome/browser/extensions/window_controller_list.h"
14 #include "chrome/browser/profiles/profile.h" 14 #include "chrome/browser/profiles/profile.h"
15 #include "chrome/browser/sessions/session_tab_helper.h" 15 #include "chrome/browser/sessions/session_tab_helper.h"
16 #include "content/public/browser/browser_context.h" 16 #include "content/public/browser/browser_context.h"
17 #include "content/public/browser/site_instance.h" 17 #include "content/public/browser/site_instance.h"
18 #include "content/public/browser/web_contents.h" 18 #include "content/public/browser/web_contents.h"
19 #include "extensions/browser/app_window/native_app_window.h" 19 #include "extensions/browser/app_window/native_app_window.h"
20 #include "extensions/common/extension.h" 20 #include "extensions/common/extension.h"
21 #include "extensions/common/permissions/api_permission.h"
22 #include "extensions/common/permissions/permissions_data.h"
21 #include "ui/gfx/image/image.h" 23 #include "ui/gfx/image/image.h"
22 24
23 using extensions::AppWindow; 25 using extensions::AppWindow;
24 using extensions::NativeAppWindow; 26 using extensions::NativeAppWindow;
25 27
26 // AshPanelWindowController ---------------------------------------------------- 28 // AshPanelWindowController ----------------------------------------------------
27 29
28 // This class enables an AppWindow instance to be accessed (to a limited 30 // This class enables an AppWindow instance to be accessed (to a limited
29 // extent) via the chrome.windows and chrome.tabs API. This is a temporary 31 // extent) via the chrome.windows and chrome.tabs API. This is a temporary
30 // bridge to support instantiating AppWindows from v1 apps, specifically 32 // bridge to support instantiating AppWindows from v1 apps, specifically
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 return true; 134 return true;
133 } 135 }
134 136
135 void AshPanelWindowController::SetFullscreenMode( 137 void AshPanelWindowController::SetFullscreenMode(
136 bool is_fullscreen, const GURL& extension_url) const { 138 bool is_fullscreen, const GURL& extension_url) const {
137 // Do nothing. Panels cannot be fullscreen. 139 // Do nothing. Panels cannot be fullscreen.
138 } 140 }
139 141
140 bool AshPanelWindowController::IsVisibleToExtension( 142 bool AshPanelWindowController::IsVisibleToExtension(
141 const extensions::Extension* extension) const { 143 const extensions::Extension* extension) const {
144 if (extension->permissions_data()->HasAPIPermission(
145 extensions::APIPermission::kWindowsGlobal))
146 return true;
142 return extension->id() == app_window_->extension_id(); 147 return extension->id() == app_window_->extension_id();
143 } 148 }
144 149
145 void AshPanelWindowController::NativeWindowChanged() { 150 void AshPanelWindowController::NativeWindowChanged() {
146 bool active = app_window_->GetBaseWindow()->IsActive(); 151 bool active = app_window_->GetBaseWindow()->IsActive();
147 if (active == is_active_) 152 if (active == is_active_)
148 return; 153 return;
149 is_active_ = active; 154 is_active_ = active;
150 // Let the extension API know that the active window changed. 155 // Let the extension API know that the active window changed.
151 extensions::TabsWindowsAPI* tabs_windows_api = 156 extensions::TabsWindowsAPI* tabs_windows_api =
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 217
213 extensions::WindowController* AshPanelContents::GetWindowController() const { 218 extensions::WindowController* AshPanelContents::GetWindowController() const {
214 return window_controller_.get(); 219 return window_controller_.get();
215 } 220 }
216 221
217 void AshPanelContents::FaviconUpdated() { 222 void AshPanelContents::FaviconUpdated() {
218 gfx::Image new_image = gfx::Image::CreateFrom1xBitmap( 223 gfx::Image new_image = gfx::Image::CreateFrom1xBitmap(
219 launcher_favicon_loader_->GetFavicon()); 224 launcher_favicon_loader_->GetFavicon());
220 host_->UpdateAppIcon(new_image); 225 host_->UpdateAppIcon(new_image);
221 } 226 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698