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

Side by Side Diff: chrome/browser/platform_util_chromeos.cc

Issue 10967003: Add desktop type context to most existing instances of FindTabbedBrowser. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Moving check_deps exception to specific_include_rules after chat with Kai. Created 8 years, 2 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
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/platform_util.h" 5 #include "chrome/browser/platform_util.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
11 #include "chrome/browser/chromeos/extensions/file_manager_util.h" 11 #include "chrome/browser/chromeos/extensions/file_manager_util.h"
12 #include "chrome/browser/profiles/profile_manager.h" 12 #include "chrome/browser/profiles/profile_manager.h"
13 #include "chrome/browser/ui/browser_finder.h" 13 #include "chrome/browser/ui/browser_finder.h"
14 #include "chrome/browser/ui/browser_navigator.h" 14 #include "chrome/browser/ui/browser_navigator.h"
15 #include "chrome/browser/ui/host_desktop.h"
15 #include "chrome/browser/ui/tabs/tab_strip_model.h" 16 #include "chrome/browser/ui/tabs/tab_strip_model.h"
16 #include "content/public/browser/browser_thread.h" 17 #include "content/public/browser/browser_thread.h"
17 #include "googleurl/src/gurl.h" 18 #include "googleurl/src/gurl.h"
18 19
19 using content::BrowserThread; 20 using content::BrowserThread;
20 21
21 class Profile; 22 class Profile;
22 23
23 namespace { 24 namespace {
24 25
25 const char kGmailComposeUrl[] = 26 const char kGmailComposeUrl[] =
26 "https://mail.google.com/mail/?extsrc=mailto&url="; 27 "https://mail.google.com/mail/?extsrc=mailto&url=";
27 28
28 void OpenItemOnFileThread(const FilePath& full_path) { 29 void OpenItemOnFileThread(const FilePath& full_path) {
29 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 30 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
30 base::Closure callback; 31 base::Closure callback;
31 if (file_util::DirectoryExists(full_path)) 32 if (file_util::DirectoryExists(full_path))
32 callback = base::Bind(&file_manager_util::ViewFolder, full_path); 33 callback = base::Bind(&file_manager_util::ViewFolder, full_path);
33 else 34 else
34 callback = base::Bind(&file_manager_util::ViewFile, full_path); 35 callback = base::Bind(&file_manager_util::ViewFile, full_path);
35 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, callback); 36 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, callback);
36 } 37 }
37 38
38 void OpenURL(const std::string& url) { 39 void OpenURL(const std::string& url) {
39 // TODO(beng): improve this to locate context from call stack. 40 // TODO(beng): improve this to locate context from call stack.
40 Browser* browser = browser::FindOrCreateTabbedBrowser( 41 Browser* browser = browser::FindOrCreateTabbedBrowser(
41 ProfileManager::GetDefaultProfileOrOffTheRecord()); 42 ProfileManager::GetDefaultProfileOrOffTheRecord(),
43 chrome::HOST_DESKTOP_TYPE_ASH);
42 chrome::NavigateParams params( 44 chrome::NavigateParams params(
43 browser, GURL(url), content::PAGE_TRANSITION_LINK); 45 browser, GURL(url), content::PAGE_TRANSITION_LINK);
44 params.disposition = NEW_FOREGROUND_TAB; 46 params.disposition = NEW_FOREGROUND_TAB;
45 chrome::Navigate(&params); 47 chrome::Navigate(&params);
46 } 48 }
47 49
48 } // namespace 50 } // namespace
49 51
50 namespace platform_util { 52 namespace platform_util {
51 53
(...skipping 20 matching lines...) Expand all
72 // As such we should keep this code here. 74 // As such we should keep this code here.
73 if (url.SchemeIs("mailto")) { 75 if (url.SchemeIs("mailto")) {
74 std::string string_url = kGmailComposeUrl; 76 std::string string_url = kGmailComposeUrl;
75 string_url.append(url.spec()); 77 string_url.append(url.spec());
76 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, 78 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
77 base::Bind(OpenURL, string_url)); 79 base::Bind(OpenURL, string_url));
78 } 80 }
79 } 81 }
80 82
81 } // namespace platform_util 83 } // namespace platform_util
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/test/test_api.cc ('k') | chrome/browser/profiles/avatar_menu_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698