Commit a4b140b2 authored by Dirk Pranke's avatar Dirk Pranke Committed by Commit Bot

Revert "Reuse kArcIntentHelperPackageName in c/b/"

This reverts commit bf228a61.

Reason for revert: Didn't compile properly on CrOS (which we missed due to a bad CQ configuration).

Original change's description:
> Reuse kArcIntentHelperPackageName in c/b/
> 
> Reusing kArcIntentHelperPackageName where needed. Also adding a method
> to reuse such package name + a custom string appended to it, this is
> AppendStringToIntentHelperPackageName.
> 
> Bug: None
> Test: Build.
> Change-Id: I1b9115b808533e1e5ed3339b7f3747496ca2f0c3
> Reviewed-on: https://chromium-review.googlesource.com/764396
> Reviewed-by: Scott Violet <sky@chromium.org>
> Reviewed-by: Yusuke Sato <yusukes@chromium.org>
> Commit-Queue: David Jacobo <djacobo@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#516326}

TBR=yusukes@chromium.org,sky@chromium.org,djacobo@chromium.org

Change-Id: Idfef3e2b248c5a1339bb97c47be0f3a6cdf84ba3
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: None
Reviewed-on: https://chromium-review.googlesource.com/769187Reviewed-by: default avatarDirk Pranke <dpranke@chromium.org>
Commit-Queue: Dirk Pranke <dpranke@chromium.org>
Cr-Commit-Position: refs/heads/master@{#516341}
parent 9b9a86df
...@@ -31,7 +31,6 @@ ...@@ -31,7 +31,6 @@
#include "components/arc/arc_bridge_service.h" #include "components/arc/arc_bridge_service.h"
#include "components/arc/arc_browser_context_keyed_service_factory_base.h" #include "components/arc/arc_browser_context_keyed_service_factory_base.h"
#include "components/arc/bluetooth/bluetooth_type_converters.h" #include "components/arc/bluetooth/bluetooth_type_converters.h"
#include "components/arc/intent_helper/arc_intent_helper_bridge.h"
#include "components/device_event_log/device_event_log.h" #include "components/device_event_log/device_event_log.h"
#include "components/prefs/pref_service.h" #include "components/prefs/pref_service.h"
#include "components/user_manager/user_manager.h" #include "components/user_manager/user_manager.h"
...@@ -1495,12 +1494,9 @@ void ArcBluetoothBridge::SendBluetoothPoweredStateBroadcast( ...@@ -1495,12 +1494,9 @@ void ArcBluetoothBridge::SendBluetoothPoweredStateBroadcast(
DCHECK(write_success); DCHECK(write_success);
intent_instance->SendBroadcast( intent_instance->SendBroadcast(
ArcIntentHelperBridge::AppendStringToIntentHelperPackageName( "org.chromium.arc.intent_helper.SET_BLUETOOTH_STATE",
"SET_BLUETOOTH_STATE"), "org.chromium.arc.intent_helper",
ArcIntentHelperBridge::kArcIntentHelperPackageName, "org.chromium.arc.intent_helper.SettingsReceiver", extras_json);
ArcIntentHelperBridge::AppendStringToIntentHelperPackageName(
"SettingsReceiver"),
extras_json);
} }
void ArcBluetoothBridge::ReadGattCharacteristic( void ArcBluetoothBridge::ReadGattCharacteristic(
......
...@@ -32,7 +32,6 @@ ...@@ -32,7 +32,6 @@
#include "components/arc/arc_bridge_service.h" #include "components/arc/arc_bridge_service.h"
#include "components/arc/arc_browser_context_keyed_service_factory_base.h" #include "components/arc/arc_browser_context_keyed_service_factory_base.h"
#include "components/arc/arc_prefs.h" #include "components/arc/arc_prefs.h"
#include "components/arc/intent_helper/arc_intent_helper_bridge.h"
#include "components/arc/intent_helper/font_size_util.h" #include "components/arc/intent_helper/font_size_util.h"
#include "components/onc/onc_pref_names.h" #include "components/onc/onc_pref_names.h"
#include "components/prefs/pref_change_registrar.h" #include "components/prefs/pref_change_registrar.h"
...@@ -692,11 +691,9 @@ void ArcSettingsServiceImpl::SendSettingsBroadcast( ...@@ -692,11 +691,9 @@ void ArcSettingsServiceImpl::SendSettingsBroadcast(
bool write_success = base::JSONWriter::Write(extras, &extras_json); bool write_success = base::JSONWriter::Write(extras, &extras_json);
DCHECK(write_success); DCHECK(write_success);
instance->SendBroadcast( instance->SendBroadcast(action, "org.chromium.arc.intent_helper",
action, ArcIntentHelperBridge::kArcIntentHelperPackageName, "org.chromium.arc.intent_helper.SettingsReceiver",
ArcIntentHelperBridge::AppendStringToIntentHelperPackageName( extras_json);
"SettingsReceiver"),
extras_json);
} }
// InstanceHolder<mojom::AppInstance>::Observer: // InstanceHolder<mojom::AppInstance>::Observer:
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
#include "base/memory/singleton.h" #include "base/memory/singleton.h"
#include "components/arc/arc_bridge_service.h" #include "components/arc/arc_bridge_service.h"
#include "components/arc/arc_browser_context_keyed_service_factory_base.h" #include "components/arc/arc_browser_context_keyed_service_factory_base.h"
#include "components/arc/intent_helper/arc_intent_helper_bridge.h"
#include "components/session_manager/core/session_manager.h" #include "components/session_manager/core/session_manager.h"
namespace arc { namespace arc {
...@@ -61,12 +60,9 @@ void ArcUserSessionService::OnSessionStateChanged() { ...@@ -61,12 +60,9 @@ void ArcUserSessionService::OnSessionStateChanged() {
return; return;
instance->SendBroadcast( instance->SendBroadcast(
ArcIntentHelperBridge::AppendStringToIntentHelperPackageName( "org.chromium.arc.intent_helper.USER_SESSION_ACTIVE",
"USER_SESSION_ACTIVE"), "org.chromium.arc.intent_helper",
ArcIntentHelperBridge::kArcIntentHelperPackageName, "org.chromium.arc.intent_helper.ArcIntentHelperService", "{}");
ArcIntentHelperBridge::AppendStringToIntentHelperPackageName(
"ArcIntentHelperService"),
"{}");
} }
void ArcUserSessionService::OnInstanceReady() { void ArcUserSessionService::OnInstanceReady() {
......
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
#include "components/arc/arc_service_manager.h" #include "components/arc/arc_service_manager.h"
#include "components/arc/arc_util.h" #include "components/arc/arc_util.h"
#include "components/arc/common/intent_helper.mojom.h" #include "components/arc/common/intent_helper.mojom.h"
#include "components/arc/intent_helper/arc_intent_helper_bridge.h"
#include "components/crx_file/id_util.h" #include "components/crx_file/id_util.h"
#include "ui/aura/window.h" #include "ui/aura/window.h"
#include "ui/display/display.h" #include "ui/display/display.h"
...@@ -56,11 +55,10 @@ namespace arc { ...@@ -56,11 +55,10 @@ namespace arc {
namespace { namespace {
// TODO(djacobo): Evaluate to build these strings by using
// ArcIntentHelperBridge::AppendStringToIntentHelperPackageName.
// Intent helper strings. // Intent helper strings.
constexpr char kIntentHelperClassName[] = constexpr char kIntentHelperClassName[] =
"org.chromium.arc.intent_helper.SettingsReceiver"; "org.chromium.arc.intent_helper.SettingsReceiver";
constexpr char kIntentHelperPackageName[] = "org.chromium.arc.intent_helper";
constexpr char kSetInTouchModeIntent[] = constexpr char kSetInTouchModeIntent[] =
"org.chromium.arc.intent_helper.SET_IN_TOUCH_MODE"; "org.chromium.arc.intent_helper.SET_IN_TOUCH_MODE";
constexpr char kShowTalkbackSettingsIntent[] = constexpr char kShowTalkbackSettingsIntent[] =
...@@ -120,9 +118,8 @@ bool Launch(content::BrowserContext* context, ...@@ -120,9 +118,8 @@ bool Launch(content::BrowserContext* context,
std::string extras_string; std::string extras_string;
base::JSONWriter::Write(extras, &extras_string); base::JSONWriter::Write(extras, &extras_string);
intent_helper_instance->SendBroadcast( intent_helper_instance->SendBroadcast(
kSetInTouchModeIntent, kSetInTouchModeIntent, kIntentHelperPackageName, kIntentHelperClassName,
ArcIntentHelperBridge::kArcIntentHelperPackageName, extras_string);
kIntentHelperClassName, extras_string);
} }
if (app_info->shortcut || intent.has_value()) { if (app_info->shortcut || intent.has_value()) {
...@@ -306,10 +303,9 @@ void ShowTalkBackSettings() { ...@@ -306,10 +303,9 @@ void ShowTalkBackSettings() {
if (!intent_helper_instance) if (!intent_helper_instance)
return; return;
intent_helper_instance->SendBroadcast( intent_helper_instance->SendBroadcast(kShowTalkbackSettingsIntent,
kShowTalkbackSettingsIntent, kIntentHelperPackageName,
ArcIntentHelperBridge::kArcIntentHelperPackageName, kIntentHelperClassName, "{}");
kIntentHelperClassName, "{}");
} }
void StartPaiFlow() { void StartPaiFlow() {
......
...@@ -4,14 +4,11 @@ ...@@ -4,14 +4,11 @@
#include "chrome/browser/ui/views/apps/app_info_dialog/arc_app_info_links_panel.h" #include "chrome/browser/ui/views/apps/app_info_dialog/arc_app_info_links_panel.h"
#include <memory>
#include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/app_list/arc/arc_app_utils.h" #include "chrome/browser/ui/app_list/arc/arc_app_utils.h"
#include "chrome/browser/ui/views/harmony/chrome_layout_provider.h" #include "chrome/browser/ui/views/harmony/chrome_layout_provider.h"
#include "chrome/grit/generated_resources.h" #include "chrome/grit/generated_resources.h"
#include "components/arc/common/app.mojom.h" #include "components/arc/common/app.mojom.h"
#include "components/arc/intent_helper/arc_intent_helper_bridge.h"
#include "ui/base/l10n/l10n_util.h" #include "ui/base/l10n/l10n_util.h"
#include "ui/display/display.h" #include "ui/display/display.h"
#include "ui/display/screen.h" #include "ui/display/screen.h"
...@@ -21,6 +18,10 @@ ...@@ -21,6 +18,10 @@
#include "ui/views/view.h" #include "ui/views/view.h"
#include "ui/views/widget/widget.h" #include "ui/views/widget/widget.h"
namespace {
constexpr char kArcChromePackageName[] = "org.chromium.arc.intent_helper";
}
ArcAppInfoLinksPanel::ArcAppInfoLinksPanel(Profile* profile, ArcAppInfoLinksPanel::ArcAppInfoLinksPanel(Profile* profile,
const extensions::Extension* app) const extensions::Extension* app)
: AppInfoPanel(profile, app), : AppInfoPanel(profile, app),
...@@ -54,9 +55,9 @@ void ArcAppInfoLinksPanel::LinkClicked(views::Link* source, int event_flags) { ...@@ -54,9 +55,9 @@ void ArcAppInfoLinksPanel::LinkClicked(views::Link* source, int event_flags) {
display::Screen::GetScreen() display::Screen::GetScreen()
->GetDisplayNearestView(source->GetWidget()->GetNativeView()) ->GetDisplayNearestView(source->GetWidget()->GetNativeView())
.id(); .id();
if (arc::ShowPackageInfo( if (arc::ShowPackageInfo(kArcChromePackageName,
arc::ArcIntentHelperBridge::kArcIntentHelperPackageName, arc::mojom::ShowPackageInfoPage::MANAGE_LINKS,
arc::mojom::ShowPackageInfoPage::MANAGE_LINKS, display_id)) { display_id)) {
Close(); Close();
} }
} }
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
#include "ash/wallpaper/wallpaper_controller.h" #include "ash/wallpaper/wallpaper_controller.h"
#include "base/memory/singleton.h" #include "base/memory/singleton.h"
#include "base/memory/weak_ptr.h" #include "base/memory/weak_ptr.h"
#include "base/strings/string_util.h"
#include "components/arc/arc_bridge_service.h" #include "components/arc/arc_bridge_service.h"
#include "components/arc/arc_browser_context_keyed_service_factory_base.h" #include "components/arc/arc_browser_context_keyed_service_factory_base.h"
#include "components/arc/arc_service_manager.h" #include "components/arc/arc_service_manager.h"
...@@ -115,12 +114,6 @@ KeyedServiceBaseFactory* ArcIntentHelperBridge::GetFactory() { ...@@ -115,12 +114,6 @@ KeyedServiceBaseFactory* ArcIntentHelperBridge::GetFactory() {
return ArcIntentHelperBridgeFactory::GetInstance(); return ArcIntentHelperBridgeFactory::GetInstance();
} }
// static
std::string ArcIntentHelperBridge::AppendStringToIntentHelperPackageName(
const std::string& to_append) {
return base::JoinString({kArcIntentHelperPackageName, to_append}, ".");
}
ArcIntentHelperBridge::ArcIntentHelperBridge(content::BrowserContext* context, ArcIntentHelperBridge::ArcIntentHelperBridge(content::BrowserContext* context,
ArcBridgeService* bridge_service) ArcBridgeService* bridge_service)
: context_(context), : context_(context),
......
...@@ -46,10 +46,6 @@ class ArcIntentHelperBridge ...@@ -46,10 +46,6 @@ class ArcIntentHelperBridge
// Returns factory for the ArcIntentHelperBridge. // Returns factory for the ArcIntentHelperBridge.
static KeyedServiceBaseFactory* GetFactory(); static KeyedServiceBaseFactory* GetFactory();
// Appends '.' + |to_append| to the intent helper package name.
static std::string AppendStringToIntentHelperPackageName(
const std::string& to_append);
ArcIntentHelperBridge(content::BrowserContext* context, ArcIntentHelperBridge(content::BrowserContext* context,
ArcBridgeService* bridge_service); ArcBridgeService* bridge_service);
~ArcIntentHelperBridge() override; ~ArcIntentHelperBridge() override;
......
...@@ -350,18 +350,4 @@ TEST_F(ArcIntentHelperTest, TestOnOpenChromeSettings) { ...@@ -350,18 +350,4 @@ TEST_F(ArcIntentHelperTest, TestOnOpenChromeSettings) {
test_open_url_delegate_->TakeLastOpenedUrl()); test_open_url_delegate_->TakeLastOpenedUrl());
} }
// Tests that AppendStringToIntentHelperPackageName works.
TEST_F(ArcIntentHelperTest, TestAppendStringToIntentHelperPackageName) {
std::string fake_activity = "this_is_a_fake_activity";
EXPECT_EQ(
ArcIntentHelperBridge::AppendStringToIntentHelperPackageName(
fake_activity),
ArcIntentHelperBridge::kArcIntentHelperPackageName + "." + fake_activity);
std::string empty_string = "";
EXPECT_EQ(ArcIntentHelperBridge::AppendStringToIntentHelperPackageName(
empty_string),
ArcIntentHelperBridge::kArcIntentHelperPackageName + ".");
}
} // namespace arc } // namespace arc
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment