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

Side by Side Diff: chrome/browser/extensions/api/desktop_capture/desktop_capture_api.cc

Issue 1239643004: extensions: tabs: set tab id to -1 for app/devtools windows (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: "may not be -1" -> "may be -1" Created 5 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 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/desktop_capture/desktop_capture_api.h" 5 #include "chrome/browser/extensions/api/desktop_capture/desktop_capture_api.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/browser/extensions/extension_tab_util.h" 9 #include "chrome/browser/extensions/extension_tab_util.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 67
68 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( 68 if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
69 switches::kAllowHttpScreenCapture) && 69 switches::kAllowHttpScreenCapture) &&
70 !content::IsOriginSecure(origin)) { 70 !content::IsOriginSecure(origin)) {
71 error_ = kTabUrlNotSecure; 71 error_ = kTabUrlNotSecure;
72 return false; 72 return false;
73 } 73 }
74 target_name = base::UTF8ToUTF16(content::IsOriginSecure(origin) ? 74 target_name = base::UTF8ToUTF16(content::IsOriginSecure(origin) ?
75 net::GetHostAndOptionalPort(origin) : origin.spec()); 75 net::GetHostAndOptionalPort(origin) : origin.spec());
76 76
77 if (!params->target_tab->id) { 77 if (params->target_tab->id < 0) {
not at google - send to devlin 2015/07/16 17:09:23 See TAB_ID_NONE comment.
llandwerlin-old 2015/07/17 11:32:04 Done.
78 error_ = kNoTabIdError; 78 error_ = kNoTabIdError;
79 return false; 79 return false;
80 } 80 }
81 81
82 if (!ExtensionTabUtil::GetTabById(*(params->target_tab->id), GetProfile(), 82 if (!ExtensionTabUtil::GetTabById(params->target_tab->id, GetProfile(),
83 true, NULL, NULL, &web_contents, NULL)) { 83 true, NULL, NULL, &web_contents, NULL)) {
84 error_ = kInvalidTabIdError; 84 error_ = kInvalidTabIdError;
85 return false; 85 return false;
86 } 86 }
87 DCHECK(web_contents); 87 DCHECK(web_contents);
88 } else { 88 } else {
89 origin = extension()->url(); 89 origin = extension()->url();
90 target_name = base::UTF8ToUTF16(extension()->name()); 90 target_name = base::UTF8ToUTF16(extension()->name());
91 web_contents = GetSenderWebContents(); 91 web_contents = GetSenderWebContents();
92 DCHECK(web_contents); 92 DCHECK(web_contents);
93 } 93 }
94 94
95 return Execute(params->sources, web_contents, origin, target_name); 95 return Execute(params->sources, web_contents, origin, target_name);
96 } 96 }
97 97
98 DesktopCaptureCancelChooseDesktopMediaFunction:: 98 DesktopCaptureCancelChooseDesktopMediaFunction::
99 DesktopCaptureCancelChooseDesktopMediaFunction() {} 99 DesktopCaptureCancelChooseDesktopMediaFunction() {}
100 100
101 DesktopCaptureCancelChooseDesktopMediaFunction:: 101 DesktopCaptureCancelChooseDesktopMediaFunction::
102 ~DesktopCaptureCancelChooseDesktopMediaFunction() {} 102 ~DesktopCaptureCancelChooseDesktopMediaFunction() {}
103 103
104 } // namespace extensions 104 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698