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

Side by Side Diff: chrome/browser/extensions/extension_tabs_module.h

Issue 8373027: Prevent incognito windows from opening when incognito mode is disabled. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Pulled incognito decision logic into a separate function. Created 9 years, 1 month 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_TABS_MODULE_H__ 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_TABS_MODULE_H__
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_TABS_MODULE_H__ 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_TABS_MODULE_H__
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 #include <vector>
10 11
11 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
12 #include "chrome/browser/extensions/extension_function.h" 13 #include "chrome/browser/extensions/extension_function.h"
13 #include "content/browser/tab_contents/tab_contents_observer.h" 14 #include "content/browser/tab_contents/tab_contents_observer.h"
14 #include "content/public/browser/notification_observer.h" 15 #include "content/public/browser/notification_observer.h"
15 #include "content/public/browser/notification_registrar.h" 16 #include "content/public/browser/notification_registrar.h"
17 #include "googleurl/src/gurl.h"
16 18
17 class BackingStore; 19 class BackingStore;
18 class SkBitmap; 20 class SkBitmap;
19 21
22 namespace base {
23 class DictionaryValue;
24 } // namespace base
25
20 // Windows 26 // Windows
21 class GetWindowFunction : public SyncExtensionFunction { 27 class GetWindowFunction : public SyncExtensionFunction {
22 virtual ~GetWindowFunction() {} 28 virtual ~GetWindowFunction() {}
23 virtual bool RunImpl() OVERRIDE; 29 virtual bool RunImpl() OVERRIDE;
24 DECLARE_EXTENSION_FUNCTION_NAME("windows.get") 30 DECLARE_EXTENSION_FUNCTION_NAME("windows.get")
25 }; 31 };
26 class GetCurrentWindowFunction : public SyncExtensionFunction { 32 class GetCurrentWindowFunction : public SyncExtensionFunction {
27 virtual ~GetCurrentWindowFunction() {} 33 virtual ~GetCurrentWindowFunction() {}
28 virtual bool RunImpl() OVERRIDE; 34 virtual bool RunImpl() OVERRIDE;
29 DECLARE_EXTENSION_FUNCTION_NAME("windows.getCurrent") 35 DECLARE_EXTENSION_FUNCTION_NAME("windows.getCurrent")
30 }; 36 };
31 class GetLastFocusedWindowFunction : public SyncExtensionFunction { 37 class GetLastFocusedWindowFunction : public SyncExtensionFunction {
32 virtual ~GetLastFocusedWindowFunction() {} 38 virtual ~GetLastFocusedWindowFunction() {}
33 virtual bool RunImpl() OVERRIDE; 39 virtual bool RunImpl() OVERRIDE;
34 DECLARE_EXTENSION_FUNCTION_NAME("windows.getLastFocused") 40 DECLARE_EXTENSION_FUNCTION_NAME("windows.getLastFocused")
35 }; 41 };
36 class GetAllWindowsFunction : public SyncExtensionFunction { 42 class GetAllWindowsFunction : public SyncExtensionFunction {
37 virtual ~GetAllWindowsFunction() {} 43 virtual ~GetAllWindowsFunction() {}
38 virtual bool RunImpl() OVERRIDE; 44 virtual bool RunImpl() OVERRIDE;
39 DECLARE_EXTENSION_FUNCTION_NAME("windows.getAll") 45 DECLARE_EXTENSION_FUNCTION_NAME("windows.getAll")
40 }; 46 };
41 class CreateWindowFunction : public SyncExtensionFunction { 47 class CreateWindowFunction : public SyncExtensionFunction {
42 virtual ~CreateWindowFunction() {} 48 virtual ~CreateWindowFunction() {}
43 virtual bool RunImpl() OVERRIDE; 49 virtual bool RunImpl() OVERRIDE;
50 // Returns whether the window should be created in incognito mode.
51 // |urls| is the list of urls to open. If we are creating an incognito window,
52 // the function will remove these urls which may not be opened in incognito
53 // mode. If window creation leads the browser into an erroneous state,
54 // |is_error| is set to true (also, error_ member variable is assigned
55 // the proper error message).
56 bool ShouldOpenIncognitoWindow(const base::DictionaryValue* args,
57 std::vector<GURL>* urls,
58 bool* is_error);
44 DECLARE_EXTENSION_FUNCTION_NAME("windows.create") 59 DECLARE_EXTENSION_FUNCTION_NAME("windows.create")
45 }; 60 };
46 class UpdateWindowFunction : public SyncExtensionFunction { 61 class UpdateWindowFunction : public SyncExtensionFunction {
47 virtual ~UpdateWindowFunction() {} 62 virtual ~UpdateWindowFunction() {}
48 virtual bool RunImpl() OVERRIDE; 63 virtual bool RunImpl() OVERRIDE;
49 DECLARE_EXTENSION_FUNCTION_NAME("windows.update") 64 DECLARE_EXTENSION_FUNCTION_NAME("windows.update")
50 }; 65 };
51 class RemoveWindowFunction : public SyncExtensionFunction { 66 class RemoveWindowFunction : public SyncExtensionFunction {
52 virtual ~RemoveWindowFunction() {} 67 virtual ~RemoveWindowFunction() {}
53 virtual bool RunImpl() OVERRIDE; 68 virtual bool RunImpl() OVERRIDE;
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 // The format (JPEG vs PNG) of the resulting image. Set in RunImpl(). 170 // The format (JPEG vs PNG) of the resulting image. Set in RunImpl().
156 ImageFormat image_format_; 171 ImageFormat image_format_;
157 172
158 // Quality setting to use when encoding jpegs. Set in RunImpl(). 173 // Quality setting to use when encoding jpegs. Set in RunImpl().
159 int image_quality_; 174 int image_quality_;
160 175
161 DECLARE_EXTENSION_FUNCTION_NAME("tabs.captureVisibleTab") 176 DECLARE_EXTENSION_FUNCTION_NAME("tabs.captureVisibleTab")
162 }; 177 };
163 178
164 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_TABS_MODULE_H__ 179 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_TABS_MODULE_H__
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_tabs_apitest.cc ('k') | chrome/browser/extensions/extension_tabs_module.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698