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

Side by Side Diff: chrome/browser/extensions/extension_window_list.cc

Issue 10407035: Extension/Platform App window isolation (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix tests Created 8 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 | Annotate | Revision Log
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/extension_window_list.h" 5 #include "chrome/browser/extensions/extension_window_list.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "chrome/browser/sessions/session_id.h" 9 #include "chrome/browser/sessions/session_id.h"
10 #include "chrome/browser/ui/base_window.h" 10 #include "chrome/browser/ui/base_window.h"
(...skipping 19 matching lines...) Expand all
30 30
31 void ExtensionWindowList::RemoveExtensionWindow( 31 void ExtensionWindowList::RemoveExtensionWindow(
32 ExtensionWindowController* window) { 32 ExtensionWindowController* window) {
33 WindowList::iterator iter = std::find( 33 WindowList::iterator iter = std::find(
34 windows_.begin(), windows_.end(), window); 34 windows_.begin(), windows_.end(), window);
35 if (iter != windows_.end()) 35 if (iter != windows_.end())
36 windows_.erase(iter); 36 windows_.erase(iter);
37 } 37 }
38 38
39 ExtensionWindowController* ExtensionWindowList::FindWindowById( 39 ExtensionWindowController* ExtensionWindowList::FindWindowById(
40 Profile* profile, 40 UIThreadExtensionFunction* function,
41 ProfileMatchType match_type,
42 int id) const { 41 int id) const {
43 for (WindowList::const_iterator iter = windows().begin(); 42 for (WindowList::const_iterator iter = windows().begin();
44 iter != windows().end(); ++iter) { 43 iter != windows().end(); ++iter) {
45 if ((*iter)->MatchesProfile(profile, match_type)) { 44 if ((*iter)->IsVisibleToFunction(function)) {
46 if ((*iter)->GetWindowId() == id) 45 if ((*iter)->GetWindowId() == id)
47 return *iter; 46 return *iter;
48 } 47 }
49 } 48 }
50 return NULL; 49 return NULL;
51 } 50 }
52 51
53 ExtensionWindowController* ExtensionWindowList::CurrentWindow( 52 ExtensionWindowController* ExtensionWindowList::CurrentWindow(
54 Profile* profile, 53 UIThreadExtensionFunction* function) const {
55 ProfileMatchType match_type) const {
56 ExtensionWindowController* result = NULL; 54 ExtensionWindowController* result = NULL;
57 // Returns either the focused window (if any), or the last window in the list. 55 // Returns either the focused window (if any), or the last window in the list.
58 for (WindowList::const_iterator iter = windows().begin(); 56 for (WindowList::const_iterator iter = windows().begin();
59 iter != windows().end(); ++iter) { 57 iter != windows().end(); ++iter) {
60 if ((*iter)->MatchesProfile(profile, match_type)) { 58 if ((*iter)->IsVisibleToFunction(function)) {
61 result = *iter; 59 result = *iter;
62 if (result->window()->IsActive()) 60 if (result->window()->IsActive())
63 break; // use focused window 61 break; // use focused window
64 } 62 }
65 } 63 }
66 return result; 64 return result;
67 } 65 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698