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

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

Issue 10692110: screenshot disabling policy (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 5 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.h" 5 #include "chrome/browser/extensions/api/tabs/tabs.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 #include "ui/base/ui_base_types.h" 72 #include "ui/base/ui_base_types.h"
73 #include "ui/gfx/codec/jpeg_codec.h" 73 #include "ui/gfx/codec/jpeg_codec.h"
74 #include "ui/gfx/codec/png_codec.h" 74 #include "ui/gfx/codec/png_codec.h"
75 75
76 #if defined(USE_ASH) 76 #if defined(USE_ASH)
77 #include "ash/ash_switches.h" 77 #include "ash/ash_switches.h"
78 #include "base/command_line.h" 78 #include "base/command_line.h"
79 #include "chrome/browser/ui/views/ash/panel_view_aura.h" 79 #include "chrome/browser/ui/views/ash/panel_view_aura.h"
80 #endif 80 #endif
81 81
82 #if defined(OS_CHROMEOS)
Mattias Nissler (ping if slow) 2012/07/06 15:15:52 no need for preprocessor guards
qfel 2012/07/06 17:00:39 Done
83 #include "chrome/browser/browser_process.h"
84 #include "chrome/browser/prefs/pref_service.h"
85 #endif
86
82 #if defined(OS_WIN) 87 #if defined(OS_WIN)
83 #include "base/win/metro.h" 88 #include "base/win/metro.h"
84 #endif // OS_WIN 89 #endif // OS_WIN
85 90
86 namespace Get = extensions::api::windows::Get; 91 namespace Get = extensions::api::windows::Get;
87 namespace GetAll = extensions::api::windows::GetAll; 92 namespace GetAll = extensions::api::windows::GetAll;
88 namespace GetCurrent = extensions::api::windows::GetCurrent; 93 namespace GetCurrent = extensions::api::windows::GetCurrent;
89 namespace GetLastFocused = extensions::api::windows::GetLastFocused; 94 namespace GetLastFocused = extensions::api::windows::GetLastFocused;
90 namespace errors = extension_manifest_errors; 95 namespace errors = extension_manifest_errors;
91 namespace keys = extensions::tabs_constants; 96 namespace keys = extensions::tabs_constants;
(...skipping 1500 matching lines...) Expand 10 before | Expand all | Expand 10 after
1592 error_ = keys::kInternalVisibleTabCaptureError; 1597 error_ = keys::kInternalVisibleTabCaptureError;
1593 return false; 1598 return false;
1594 } 1599 }
1595 1600
1596 *tab_contents = chrome::GetActiveTabContents(browser); 1601 *tab_contents = chrome::GetActiveTabContents(browser);
1597 1602
1598 return true; 1603 return true;
1599 }; 1604 };
1600 1605
1601 bool CaptureVisibleTabFunction::RunImpl() { 1606 bool CaptureVisibleTabFunction::RunImpl() {
1607 PrefService* service = g_browser_process->local_state();
Mattias Nissler (ping if slow) 2012/07/06 15:15:52 Have you thought about registering this as a Profi
qfel 2012/07/06 17:00:39 Done.
1608 if (service->GetBoolean(prefs::kDisableScreenshots))
1609 EXTENSION_FUNCTION_ERROR("keys::kXXX");
Mattias Nissler (ping if slow) 2012/07/06 15:15:52 add proper constants.
qfel 2012/07/06 17:00:39 Done.
1610
1602 WebContents* web_contents = NULL; 1611 WebContents* web_contents = NULL;
1603 TabContents* tab_contents = NULL; 1612 TabContents* tab_contents = NULL;
1604 if (!GetTabToCapture(&web_contents, &tab_contents)) 1613 if (!GetTabToCapture(&web_contents, &tab_contents))
1605 return false; 1614 return false;
1606 1615
1607 image_format_ = FORMAT_JPEG; // Default format is JPEG. 1616 image_format_ = FORMAT_JPEG; // Default format is JPEG.
1608 image_quality_ = kDefaultQuality; // Default quality setting. 1617 image_quality_ = kDefaultQuality; // Default quality setting.
1609 1618
1610 if (HasOptionalArgument(1)) { 1619 if (HasOptionalArgument(1)) {
1611 DictionaryValue* options = NULL; 1620 DictionaryValue* options = NULL;
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
1826 // called for every API call the extension made. 1835 // called for every API call the extension made.
1827 GotLanguage(language); 1836 GotLanguage(language);
1828 } 1837 }
1829 1838
1830 void DetectTabLanguageFunction::GotLanguage(const std::string& language) { 1839 void DetectTabLanguageFunction::GotLanguage(const std::string& language) {
1831 result_.reset(Value::CreateStringValue(language.c_str())); 1840 result_.reset(Value::CreateStringValue(language.c_str()));
1832 SendResponse(true); 1841 SendResponse(true);
1833 1842
1834 Release(); // Balanced in Run() 1843 Release(); // Balanced in Run()
1835 } 1844 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698