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

Side by Side Diff: chrome/browser/chromeos/file_manager/open_with_browser.cc

Issue 149703006: Fixing problem with browser invocations from a visiting files application (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix Win Created 6 years, 10 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 | chrome/browser/ui/ash/multi_user/multi_user_util.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/chromeos/file_manager/open_with_browser.h" 5 #include "chrome/browser/chromeos/file_manager/open_with_browser.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
11 #include "base/threading/sequenced_worker_pool.h" 11 #include "base/threading/sequenced_worker_pool.h"
12 #include "chrome/browser/browser_process.h" 12 #include "chrome/browser/browser_process.h"
13 #include "chrome/browser/chromeos/drive/file_system_util.h" 13 #include "chrome/browser/chromeos/drive/file_system_util.h"
14 #include "chrome/browser/plugins/plugin_prefs.h" 14 #include "chrome/browser/plugins/plugin_prefs.h"
15 #include "chrome/browser/profiles/profile_manager.h" 15 #include "chrome/browser/profiles/profile_manager.h"
16 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h"
16 #include "chrome/browser/ui/browser.h" 17 #include "chrome/browser/ui/browser.h"
17 #include "chrome/browser/ui/browser_tabstrip.h" 18 #include "chrome/browser/ui/browser_tabstrip.h"
18 #include "chrome/browser/ui/browser_window.h" 19 #include "chrome/browser/ui/browser_window.h"
19 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" 20 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h"
20 #include "chrome/common/chrome_paths.h" 21 #include "chrome/common/chrome_paths.h"
21 #include "chrome/common/chrome_switches.h" 22 #include "chrome/common/chrome_switches.h"
22 #include "content/public/browser/browser_thread.h" 23 #include "content/public/browser/browser_thread.h"
23 #include "content/public/browser/plugin_service.h" 24 #include "content/public/browser/plugin_service.h"
24 #include "content/public/common/pepper_plugin_info.h" 25 #include "content/public/common/pepper_plugin_info.h"
25 #include "net/base/net_util.h" 26 #include "net/base/net_util.h"
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 101
101 // Check the validity of the pointer so that the closure from 102 // Check the validity of the pointer so that the closure from
102 // base::Bind(&OpenNewTab, profile) can be passed between threads. 103 // base::Bind(&OpenNewTab, profile) can be passed between threads.
103 if (!g_browser_process->profile_manager()->IsValidProfile(profile)) 104 if (!g_browser_process->profile_manager()->IsValidProfile(profile))
104 return; 105 return;
105 106
106 chrome::ScopedTabbedBrowserDisplayer displayer( 107 chrome::ScopedTabbedBrowserDisplayer displayer(
107 profile, chrome::HOST_DESKTOP_TYPE_ASH); 108 profile, chrome::HOST_DESKTOP_TYPE_ASH);
108 chrome::AddSelectedTabWithURL(displayer.browser(), url, 109 chrome::AddSelectedTabWithURL(displayer.browser(), url,
109 content::PAGE_TRANSITION_LINK); 110 content::PAGE_TRANSITION_LINK);
111
112 // Since the ScopedTabbedBrowserDisplayer does not guarantee that the
113 // browser will be shown on the active desktop, we ensure the visibility.
114 multi_user_util::MoveWindowToCurrentDesktop(
115 displayer.browser()->window()->GetNativeWindow());
110 } 116 }
111 117
112 // Reads the alternate URL from a GDoc file. When it fails, returns a file URL 118 // Reads the alternate URL from a GDoc file. When it fails, returns a file URL
113 // for |file_path| as fallback. 119 // for |file_path| as fallback.
114 // Note that an alternate url is a URL to open a hosted document. 120 // Note that an alternate url is a URL to open a hosted document.
115 GURL ReadUrlFromGDocOnBlockingPool(const base::FilePath& file_path) { 121 GURL ReadUrlFromGDocOnBlockingPool(const base::FilePath& file_path) {
116 GURL url = drive::util::ReadUrlFromGDocFile(file_path); 122 GURL url = drive::util::ReadUrlFromGDocFile(file_path);
117 if (url.is_empty()) 123 if (url.is_empty())
118 url = net::FilePathToFileURL(file_path); 124 url = net::FilePathToFileURL(file_path);
119 return url; 125 return url;
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 base::FilePath::FromUTF8Unsafe("dummy").AddExtension(file_extension); 178 base::FilePath::FromUTF8Unsafe("dummy").AddExtension(file_extension);
173 if (file_path.MatchesExtension(kPdfExtension)) 179 if (file_path.MatchesExtension(kPdfExtension))
174 return IsPdfPluginEnabled(profile); 180 return IsPdfPluginEnabled(profile);
175 if (file_path.MatchesExtension(kSwfExtension)) 181 if (file_path.MatchesExtension(kSwfExtension))
176 return IsFlashPluginEnabled(profile); 182 return IsFlashPluginEnabled(profile);
177 return false; 183 return false;
178 } 184 }
179 185
180 } // namespace util 186 } // namespace util
181 } // namespace file_manager 187 } // namespace file_manager
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/ash/multi_user/multi_user_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698