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

Side by Side Diff: chrome/browser/devtools/browser_list_tabcontents_provider.cc

Issue 15356002: http 'new' opens 2 tabs when there are no windows on cros. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: minor Created 7 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/devtools/browser_list_tabcontents_provider.h" 5 #include "chrome/browser/devtools/browser_list_tabcontents_provider.h"
6 6
7 #include "base/path_service.h" 7 #include "base/path_service.h"
8 #include "base/string_number_conversions.h" 8 #include "base/string_number_conversions.h"
9 #include "chrome/browser/extensions/extension_host.h" 9 #include "chrome/browser/extensions/extension_host.h"
10 #include "chrome/browser/extensions/extension_service.h" 10 #include "chrome/browser/extensions/extension_service.h"
11 #include "chrome/browser/extensions/extension_system.h" 11 #include "chrome/browser/extensions/extension_system.h"
12 #include "chrome/browser/history/top_sites.h" 12 #include "chrome/browser/history/top_sites.h"
13 #include "chrome/browser/profiles/profile.h" 13 #include "chrome/browser/profiles/profile.h"
14 #include "chrome/browser/profiles/profile_manager.h" 14 #include "chrome/browser/profiles/profile_manager.h"
15 #include "chrome/browser/ui/browser.h" 15 #include "chrome/browser/ui/browser.h"
16 #include "chrome/browser/ui/browser_commands.h" 16 #include "chrome/browser/ui/browser_commands.h"
17 #include "chrome/browser/ui/browser_iterator.h" 17 #include "chrome/browser/ui/browser_iterator.h"
18 #include "chrome/browser/ui/browser_list.h" 18 #include "chrome/browser/ui/browser_list.h"
19 #include "chrome/browser/ui/browser_tabstrip.h" 19 #include "chrome/browser/ui/browser_tabstrip.h"
20 #include "chrome/browser/ui/host_desktop.h" 20 #include "chrome/browser/ui/host_desktop.h"
21 #include "chrome/browser/ui/tab_contents/tab_contents_iterator.h" 21 #include "chrome/browser/ui/tab_contents/tab_contents_iterator.h"
22 #include "chrome/browser/ui/tabs/tab_strip_model.h"
22 #include "chrome/common/chrome_paths.h" 23 #include "chrome/common/chrome_paths.h"
23 #include "content/public/browser/web_contents.h" 24 #include "content/public/browser/web_contents.h"
24 #include "content/public/common/url_constants.h" 25 #include "content/public/common/url_constants.h"
25 #include "grit/devtools_discovery_page_resources.h" 26 #include "grit/devtools_discovery_page_resources.h"
26 #include "net/socket/tcp_listen_socket.h" 27 #include "net/socket/tcp_listen_socket.h"
27 #include "net/url_request/url_request_context_getter.h" 28 #include "net/url_request/url_request_context_getter.h"
28 #include "ui/base/resource/resource_bundle.h" 29 #include "ui/base/resource/resource_bundle.h"
29 30
30 using content::DevToolsHttpHandlerDelegate; 31 using content::DevToolsHttpHandlerDelegate;
31 using content::RenderViewHost; 32 using content::RenderViewHost;
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 reinterpret_cast<const char*>(data->front()), data->size()); 85 reinterpret_cast<const char*>(data->front()), data->size());
85 } 86 }
86 87
87 return std::string(); 88 return std::string();
88 } 89 }
89 90
90 RenderViewHost* BrowserListTabContentsProvider::CreateNewTarget() { 91 RenderViewHost* BrowserListTabContentsProvider::CreateNewTarget() {
91 const BrowserList* browser_list = 92 const BrowserList* browser_list =
92 BrowserList::GetInstance(host_desktop_type_); 93 BrowserList::GetInstance(host_desktop_type_);
93 94
94 if (browser_list->empty()) 95 if (browser_list->empty()) {
95 chrome::NewEmptyWindow(profile_, host_desktop_type_); 96 chrome::NewEmptyWindow(profile_, host_desktop_type_);
96 97 return browser_list->empty() ? NULL :
97 if (browser_list->empty()) 98 browser_list->get(0)->tab_strip_model()->GetActiveWebContents()->
98 return NULL; 99 GetRenderViewHost();
100 }
99 101
100 content::WebContents* web_contents = chrome::AddSelectedTabWithURL( 102 content::WebContents* web_contents = chrome::AddSelectedTabWithURL(
101 browser_list->get(0), 103 browser_list->get(0),
102 GURL(content::kAboutBlankURL), 104 GURL(content::kAboutBlankURL),
103 content::PAGE_TRANSITION_LINK); 105 content::PAGE_TRANSITION_LINK);
104 return web_contents->GetRenderViewHost(); 106 return web_contents->GetRenderViewHost();
105 } 107 }
106 108
107 content::DevToolsHttpHandlerDelegate::TargetType 109 content::DevToolsHttpHandlerDelegate::TargetType
108 BrowserListTabContentsProvider::GetTargetType(content::RenderViewHost* rvh) { 110 BrowserListTabContentsProvider::GetTargetType(content::RenderViewHost* rvh) {
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 return net::TCPListenSocket::CreateAndListen("127.0.0.1", port, delegate); 151 return net::TCPListenSocket::CreateAndListen("127.0.0.1", port, delegate);
150 } 152 }
151 #else 153 #else
152 scoped_refptr<net::StreamListenSocket> 154 scoped_refptr<net::StreamListenSocket>
153 BrowserListTabContentsProvider::CreateSocketForTethering( 155 BrowserListTabContentsProvider::CreateSocketForTethering(
154 net::StreamListenSocket::Delegate* delegate, 156 net::StreamListenSocket::Delegate* delegate,
155 std::string* name) { 157 std::string* name) {
156 return NULL; 158 return NULL;
157 } 159 }
158 #endif // defined(DEBUG_DEVTOOLS) 160 #endif // defined(DEBUG_DEVTOOLS)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698