-
Notifications
You must be signed in to change notification settings - Fork 879
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue 8416: Introduce speedreader button. #5085
Changes from all commits
1617f66
51f575d
ee861c4
c3698bc
d93407e
beda457
66d05f6
5c1b806
be9b0fd
1503aab
c835a62
91894ec
d2495b0
9b98691
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
CANVAS_DIMENSIONS, 24, | ||
MOVE_TO, 17.46f, 8.17f, | ||
H_LINE_TO, 5.54f, | ||
R_ARC_TO, 0.54f, 0.54f, 0, 0, 1, 0, -1.08f, | ||
R_H_LINE_TO, 11.92f, | ||
R_ARC_TO, 0.54f, 0.54f, 0, 0, 1, 0, 1.08f, | ||
CLOSE, | ||
MOVE_TO, 5.54f, 10.33f, | ||
R_H_LINE_TO, 7.58f, | ||
R_ARC_TO, 0.54f, 0.54f, 0, 0, 1, 0, 1.08f, | ||
H_LINE_TO, 5.54f, | ||
R_ARC_TO, 0.54f, 0.54f, 0, 0, 1, 0, -1.08f, | ||
CLOSE, | ||
R_MOVE_TO, 0, 3.25f, | ||
R_H_LINE_TO, 11.92f, | ||
R_ARC_TO, 0.54f, 0.54f, 0, 0, 1, 0, 1.08f, | ||
H_LINE_TO, 5.54f, | ||
R_ARC_TO, 0.54f, 0.54f, 0, 0, 1, 0, -1.08f, | ||
CLOSE, | ||
R_MOVE_TO, 0, 3.25f, | ||
R_H_LINE_TO, 7.58f, | ||
R_ARC_TO, 0.54f, 0.54f, 0, 0, 1, 0, 1.08f, | ||
H_LINE_TO, 5.54f, | ||
R_ARC_TO, 0.54f, 0.54f, 0, 0, 1, 0, -1.08f, | ||
CLOSE |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
CANVAS_DIMENSIONS, 24, | ||
PATH_COLOR_ARGB, 0xFF, 0xFF, 0xFF, 0xFF, | ||
MOVE_TO, 17.85f, 4, | ||
R_H_LINE_TO, -11.7f, | ||
CUBIC_TO, 5.29f, 4, 4.6f, 4.71f, 4.6f, 5.58f, | ||
R_V_LINE_TO, 12.5f, | ||
R_CUBIC_TO, 0, 0.87f, 0.69f, 1.59f, 1.55f, 1.59f, | ||
R_H_LINE_TO, 11.7f, | ||
R_CUBIC_TO, 0.85f, 0, 1.55f, -0.71f, 1.55f, -1.58f, | ||
R_V_LINE_TO, -12.5f, | ||
R_CUBIC_TO, 0, -0.87f, -0.69f, -1.58f, -1.55f, -1.58f, | ||
CLOSE, | ||
NEW_PATH, | ||
PATH_COLOR_ARGB, 0xFF, 0xFB, 0x54, 0x2B, | ||
MOVE_TO, 15.94f, 8.58f, | ||
H_LINE_TO, 7.64f, | ||
R_ARC_TO, 0.74f, 0.74f, 0, 0, 1, 0, -1.47f, | ||
R_H_LINE_TO, 8.31f, | ||
R_ARC_TO, 0.74f, 0.74f, 0, 1, 1, 0, 1.47f, | ||
MOVE_TO, 6.9f, 10.57f, | ||
R_CUBIC_TO, 0, -0.41f, 0.41f, -0.74f, 0.91f, -0.74f, | ||
R_H_LINE_TO, 6.14f, | ||
R_CUBIC_TO, 0.51f, 0, 0.91f, 0.33f, 0.91f, 0.74f, | ||
R_CUBIC_TO, 0, 0.41f, -0.41f, 0.74f, -0.91f, 0.74f, | ||
H_LINE_TO, 7.81f, | ||
R_CUBIC_TO, -0.5f, 0, -0.91f, -0.33f, -0.91f, -0.74f, | ||
R_MOVE_TO, 8.93f, 3.54f, | ||
H_LINE_TO, 7.64f, | ||
R_ARC_TO, 0.74f, 0.74f, 0, 1, 1, 0, -1.47f, | ||
R_H_LINE_TO, 8.2f, | ||
R_ARC_TO, 0.74f, 0.74f, 0, 0, 1, 0, 1.47f, | ||
R_MOVE_TO, -2.57f, 2.8f, | ||
H_LINE_TO, 7.64f, | ||
R_ARC_TO, 0.74f, 0.74f, 0, 0, 1, 0, -1.47f, | ||
R_H_LINE_TO, 5.63f, | ||
R_ARC_TO, 0.74f, 0.74f, 0, 1, 1, 0, 1.47f, | ||
MOVE_TO, 17.85f, 4, | ||
R_H_LINE_TO, -11.7f, | ||
CUBIC_TO, 5.29f, 4, 4.6f, 4.71f, 4.6f, 5.58f, | ||
R_V_LINE_TO, 12.5f, | ||
R_CUBIC_TO, 0, 0.87f, 0.69f, 1.59f, 1.55f, 1.59f, | ||
R_H_LINE_TO, 11.7f, | ||
R_CUBIC_TO, 0.85f, 0, 1.55f, -0.71f, 1.55f, -1.58f, | ||
R_V_LINE_TO, -12.5f, | ||
R_CUBIC_TO, 0, -0.87f, -0.69f, -1.58f, -1.55f, -1.58f, | ||
CLOSE |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
CANVAS_DIMENSIONS, 24, | ||
PATH_COLOR_ARGB, 0xFF, 0xFB, 0x54, 0x2B, | ||
MOVE_TO, 17.46f, 7.17f, | ||
H_LINE_TO, 5.54f, | ||
R_ARC_TO, 0.54f, 0.54f, 0, 0, 1, 0, -1.08f, | ||
R_H_LINE_TO, 11.92f, | ||
R_ARC_TO, 0.54f, 0.54f, 0, 0, 1, 0, 1.08f, | ||
CLOSE, | ||
MOVE_TO, 5.54f, 9.33f, | ||
R_H_LINE_TO, 7.58f, | ||
R_ARC_TO, 0.54f, 0.54f, 0, 0, 1, 0, 1.08f, | ||
H_LINE_TO, 5.54f, | ||
R_ARC_TO, 0.54f, 0.54f, 0, 0, 1, 0, -1.08f, | ||
CLOSE, | ||
R_MOVE_TO, 0, 3.25f, | ||
R_H_LINE_TO, 11.92f, | ||
R_ARC_TO, 0.54f, 0.54f, 0, 0, 1, 0, 1.08f, | ||
H_LINE_TO, 5.54f, | ||
R_ARC_TO, 0.54f, 0.54f, 0, 0, 1, 0, -1.08f, | ||
CLOSE, | ||
R_MOVE_TO, 0, 3.25f, | ||
R_H_LINE_TO, 7.58f, | ||
R_ARC_TO, 0.54f, 0.54f, 0, 0, 1, 0, 1.08f, | ||
H_LINE_TO, 5.54f, | ||
R_ARC_TO, 0.54f, 0.54f, 0, 0, 1, 0, -1.08f, | ||
CLOSE |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* Copyright (c) 2020 The Brave Authors. All rights reserved. | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
* You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
#include "brave/browser/speedreader/speedreader_service_factory.h" | ||
|
||
#include "brave/components/speedreader/speedreader_service.h" | ||
#include "chrome/browser/profiles/profile.h" | ||
#include "components/keyed_service/content/browser_context_dependency_manager.h" | ||
|
||
namespace speedreader { | ||
|
||
// static | ||
SpeedreaderServiceFactory* SpeedreaderServiceFactory::GetInstance() { | ||
return base::Singleton<SpeedreaderServiceFactory>::get(); | ||
} | ||
|
||
SpeedreaderService* SpeedreaderServiceFactory::GetForProfile(Profile* profile) { | ||
return static_cast<SpeedreaderService*>( | ||
SpeedreaderServiceFactory::GetInstance()->GetServiceForBrowserContext( | ||
profile, true /*create*/)); | ||
} | ||
|
||
SpeedreaderServiceFactory::SpeedreaderServiceFactory() | ||
: BrowserContextKeyedServiceFactory( | ||
"SpeedreaderService", | ||
BrowserContextDependencyManager::GetInstance()) {} | ||
|
||
SpeedreaderServiceFactory::~SpeedreaderServiceFactory() {} | ||
|
||
KeyedService* SpeedreaderServiceFactory::BuildServiceInstanceFor( | ||
content::BrowserContext* context) const { | ||
return new SpeedreaderService( | ||
Profile::FromBrowserContext(context)->GetPrefs()); | ||
} | ||
|
||
bool SpeedreaderServiceFactory::ServiceIsCreatedWithBrowserContext() const { | ||
return true; | ||
} | ||
|
||
} // namespace speedreader |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* Copyright (c) 2020 The Brave Authors. All rights reserved. | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
* You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
#ifndef BRAVE_BROWSER_SPEEDREADER_SPEEDREADER_SERVICE_FACTORY_H_ | ||
#define BRAVE_BROWSER_SPEEDREADER_SPEEDREADER_SERVICE_FACTORY_H_ | ||
|
||
#include "base/memory/singleton.h" | ||
#include "components/keyed_service/content/browser_context_keyed_service_factory.h" | ||
#include "components/keyed_service/core/keyed_service.h" | ||
|
||
class Profile; | ||
|
||
namespace speedreader { | ||
|
||
class SpeedreaderService; | ||
|
||
class SpeedreaderServiceFactory : public BrowserContextKeyedServiceFactory { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this service & factory aren't necessary. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, I agree, though I decided to keep it in case we would add a user preference (and would need to keep a pref registrar), or something like this. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, ok. if service will have |
||
public: | ||
static SpeedreaderServiceFactory* GetInstance(); | ||
static SpeedreaderService* GetForProfile(Profile* profile); | ||
|
||
private: | ||
friend struct base::DefaultSingletonTraits<SpeedreaderServiceFactory>; | ||
SpeedreaderServiceFactory(); | ||
~SpeedreaderServiceFactory() override; | ||
|
||
SpeedreaderServiceFactory(const SpeedreaderServiceFactory&) = delete; | ||
SpeedreaderServiceFactory& operator=(const SpeedreaderServiceFactory&) = | ||
delete; | ||
|
||
// BrowserContextKeyedServiceFactory overrides: | ||
KeyedService* BuildServiceInstanceFor( | ||
content::BrowserContext* context) const override; | ||
bool ServiceIsCreatedWithBrowserContext() const override; | ||
}; | ||
|
||
} // namespace speedreader | ||
|
||
#endif // BRAVE_BROWSER_SPEEDREADER_SPEEDREADER_SERVICE_FACTORY_H_ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
more than a smoke test would be good
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I'll add more test when a component updater stuff is in place