| OLD | NEW |
| 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/android/dev_tools_server.h" | 5 #include "chrome/browser/android/dev_tools_server.h" |
| 6 | 6 |
| 7 #include <pwd.h> | 7 #include <pwd.h> |
| 8 #include <cstring> | 8 #include <cstring> |
| 9 | 9 |
| 10 #include "base/android/jni_string.h" | 10 #include "base/android/jni_string.h" |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 scoped_refptr<base::RefCountedMemory> data; | 286 scoped_refptr<base::RefCountedMemory> data; |
| 287 if (top_sites->GetPageThumbnail(url, false, &data)) | 287 if (top_sites->GetPageThumbnail(url, false, &data)) |
| 288 return std::string(reinterpret_cast<const char*>(data->front()), | 288 return std::string(reinterpret_cast<const char*>(data->front()), |
| 289 data->size()); | 289 data->size()); |
| 290 } | 290 } |
| 291 return ""; | 291 return ""; |
| 292 } | 292 } |
| 293 | 293 |
| 294 virtual scoped_ptr<content::DevToolsTarget> CreateNewTarget( | 294 virtual scoped_ptr<content::DevToolsTarget> CreateNewTarget( |
| 295 const GURL& url) OVERRIDE { | 295 const GURL& url) OVERRIDE { |
| 296 Profile* profile = | 296 Profile* profile = ProfileManager::GetActiveUserProfile(); |
| 297 g_browser_process->profile_manager()->GetDefaultProfile(); | |
| 298 TabModel* tab_model = TabModelList::GetTabModelWithProfile(profile); | 297 TabModel* tab_model = TabModelList::GetTabModelWithProfile(profile); |
| 299 if (!tab_model) | 298 if (!tab_model) |
| 300 return scoped_ptr<content::DevToolsTarget>(); | 299 return scoped_ptr<content::DevToolsTarget>(); |
| 301 WebContents* web_contents = tab_model->CreateNewTabForDevTools(url); | 300 WebContents* web_contents = tab_model->CreateNewTabForDevTools(url); |
| 302 if (!web_contents) | 301 if (!web_contents) |
| 303 return scoped_ptr<content::DevToolsTarget>(); | 302 return scoped_ptr<content::DevToolsTarget>(); |
| 304 | 303 |
| 305 for (int i = 0; i < tab_model->GetTabCount(); ++i) { | 304 for (int i = 0; i < tab_model->GetTabCount(); ++i) { |
| 306 if (web_contents != tab_model->GetWebContentsAt(i)) | 305 if (web_contents != tab_model->GetWebContentsAt(i)) |
| 307 continue; | 306 continue; |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 463 jobject obj, | 462 jobject obj, |
| 464 jint server, | 463 jint server, |
| 465 jboolean enabled) { | 464 jboolean enabled) { |
| 466 DevToolsServer* devtools_server = reinterpret_cast<DevToolsServer*>(server); | 465 DevToolsServer* devtools_server = reinterpret_cast<DevToolsServer*>(server); |
| 467 if (enabled) { | 466 if (enabled) { |
| 468 devtools_server->Start(); | 467 devtools_server->Start(); |
| 469 } else { | 468 } else { |
| 470 devtools_server->Stop(); | 469 devtools_server->Stop(); |
| 471 } | 470 } |
| 472 } | 471 } |
| OLD | NEW |