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

Unified Diff: chrome/browser/chromeos/extensions/file_manager/event_router.cc

Issue 171513005: Do not pop up Files app, when the recovery tool is running. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased and simplified. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/extensions/file_manager/event_router.cc
diff --git a/chrome/browser/chromeos/extensions/file_manager/event_router.cc b/chrome/browser/chromeos/extensions/file_manager/event_router.cc
index 3d447debbfd51c227785c5cc613c9c0142a3d31e..ab2c04395c5c5659dca1ae03340fbb2311fc5ad3 100644
--- a/chrome/browser/chromeos/extensions/file_manager/event_router.cc
+++ b/chrome/browser/chromeos/extensions/file_manager/event_router.cc
@@ -38,6 +38,7 @@
#include "content/public/browser/notification_source.h"
#include "content/public/browser/render_process_host.h"
#include "extensions/browser/event_router.h"
+#include "extensions/browser/extension_prefs.h"
#include "extensions/browser/extension_system.h"
#include "webkit/common/fileapi/file_system_types.h"
#include "webkit/common/fileapi/file_system_util.h"
@@ -120,6 +121,7 @@ void JobInfoToTransferStatus(
}
// Checks for availability of the Google+ Photos app.
+// TODO(mtomasz): Replace with crbug.com/341902 solution.
bool IsGooglePhotosInstalled(Profile *profile) {
ExtensionService* service =
extensions::ExtensionSystem::Get(profile)->extension_service();
@@ -129,9 +131,9 @@ bool IsGooglePhotosInstalled(Profile *profile) {
// Google+ Photos uses several ids for different channels. Therefore, all of
// them should be checked.
const std::string kGooglePlusPhotosIds[] = {
- "ebpbnabdhheoknfklmpddcdijjkmklkp", // G+ Photos staging
- "efjnaogkjbogokcnohkmnjdojkikgobo", // G+ Photos prod
- "ejegoaikibpmikoejfephaneibodccma" // G+ Photos dev
+ "ebpbnabdhheoknfklmpddcdijjkmklkp", // G+ Photos staging
+ "efjnaogkjbogokcnohkmnjdojkikgobo", // G+ Photos prod
+ "ejegoaikibpmikoejfephaneibodccma" // G+ Photos dev
};
for (size_t i = 0; i < arraysize(kGooglePlusPhotosIds); ++i) {
@@ -143,6 +145,28 @@ bool IsGooglePhotosInstalled(Profile *profile) {
return false;
}
+// Checks if the Recovery Tool is running. This is a temporary solution.
+// TODO(mtomasz): Replace with crbug.com/341902 solution.
+bool IsRecoveryToolRunning(Profile* profile) {
+ extensions::ExtensionPrefs* extension_prefs =
+ extensions::ExtensionPrefs::Get(profile);
+ if (!extension_prefs)
+ return false;
+
+ const std::string kRecoveryToolIds[] = {
+ "kkebgepbbgbcmghedmmdfcbdcodlkngh", // Recovert tool staging
+ "jndclpdbaamdhonoechobihbbiimdgai" // Recovery tool prod
+ };
+
+ for (size_t i = 0; i < arraysize(kRecoveryToolIds); ++i) {
+ const std::string extension_id = kRecoveryToolIds[i];
+ if (extension_prefs->IsExtensionRunning(extension_id))
+ return true;
+ }
+
+ return false;
+}
+
// Sends an event named |event_name| with arguments |event_args| to extensions.
void BroadcastEvent(Profile* profile,
const std::string& event_name,
@@ -690,18 +714,22 @@ void EventRouter::ShowRemovableDeviceInFileManager(
profile_ != ProfileManager::GetActiveUserProfile())
return;
+ // Do not pop-up the File Manager, if the recovery tool is running.
+ if (IsRecoveryToolRunning(profile_))
+ return;
+
// According to DCF (Design rule of Camera File system) by JEITA / CP-3461
// cameras should have pictures located in the DCIM root directory.
const base::FilePath dcim_path = mount_path.Append(
FILE_PATH_LITERAL("DCIM"));
- // If there is no DCIM folder or an external photo importer is not available,
- // then launch Files.app.
+ // If there is a DCIM folder and Google+ Photos is installed, then do not
+ // launch Files.app.
DirectoryExistsOnUIThread(
dcim_path,
- IsGooglePhotosInstalled(profile_) ?
- base::Bind(&base::DoNothing) :
- base::Bind(&util::OpenRemovableDrive, profile_, mount_path),
+ IsGooglePhotosInstalled(profile_)
+ ? base::Bind(&base::DoNothing)
+ : base::Bind(&util::OpenRemovableDrive, profile_, mount_path),
base::Bind(&util::OpenRemovableDrive, profile_, mount_path));
}
« 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