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

Unified Diff: chrome/browser/permissions/grouped_permission_infobar_delegate_android.h

Issue 2319443002: Add InfoBarIdentifier to GroupedPermissionInfoBarDelegate (Closed)
Patch Set: address review comments Created 4 years, 3 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
Index: chrome/browser/permissions/grouped_permission_infobar_delegate_android.h
diff --git a/chrome/browser/permissions/grouped_permission_infobar_delegate.h b/chrome/browser/permissions/grouped_permission_infobar_delegate_android.h
similarity index 67%
rename from chrome/browser/permissions/grouped_permission_infobar_delegate.h
rename to chrome/browser/permissions/grouped_permission_infobar_delegate_android.h
index 70dc48d5dbf3c514d40cca8242c8411a79097512..f2e3efade349fb6795af875572506396542c4774 100644
--- a/chrome/browser/permissions/grouped_permission_infobar_delegate.h
+++ b/chrome/browser/permissions/grouped_permission_infobar_delegate_android.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_PERMISSIONS_GROUPED_PERMISSION_INFOBAR_DELEGATE_H_
-#define CHROME_BROWSER_PERMISSIONS_GROUPED_PERMISSION_INFOBAR_DELEGATE_H_
+#ifndef CHROME_BROWSER_PERMISSIONS_GROUPED_PERMISSION_INFOBAR_DELEGATE_ANDROID_H_
+#define CHROME_BROWSER_PERMISSIONS_GROUPED_PERMISSION_INFOBAR_DELEGATE_ANDROID_H_
#include <memory>
@@ -23,40 +23,44 @@ class InfoBarManager;
// TODO(tsergeant): Expand this class so it can be used without subclassing.
class GroupedPermissionInfoBarDelegate : public ConfirmInfoBarDelegate {
public:
- // Implementation is in platform-specific infobar file.
- static std::unique_ptr<infobars::InfoBar> CreateInfoBar(
- infobars::InfoBarManager* infobar_manager,
- std::unique_ptr<GroupedPermissionInfoBarDelegate> delegate);
+ ~GroupedPermissionInfoBarDelegate() override;
Peter Kasting 2016/09/21 18:44:39 Nit: May be able to make private as well, dependin
lshang 2016/09/22 02:11:31 This can't be private, since we have grouped permi
Peter Kasting 2016/09/23 00:42:05 I don't really understand that reply. Normally th
lshang 2016/09/27 01:50:42 Yeah, the compiler seems complaining about one lin
Peter Kasting 2016/09/27 02:05:42 I think the problem is that GroupedPermissionInfoB
lshang 2016/09/28 00:55:05 Done.
- GroupedPermissionInfoBarDelegate(
+ // Implementation is in platform-specific infobar file.
Peter Kasting 2016/09/21 18:44:39 Nit: This comment should disappear.
lshang 2016/09/22 02:11:31 Done.
+ static infobars::InfoBar* Create(
+ InfoBarService* infobar_service,
const GURL& requesting_origin,
const std::vector<ContentSettingsType>& types);
- ~GroupedPermissionInfoBarDelegate() override;
bool ShouldShowPersistenceToggle() const;
Peter Kasting 2016/09/21 18:44:39 Nit: This deserves a comment, I think.
lshang 2016/09/22 02:11:31 Done.
bool persist() const { return persist_; }
Peter Kasting 2016/09/21 18:44:39 Nit: I suggest grouping all cheap inlined accessor
lshang 2016/09/22 02:11:30 Done.
void set_persist(bool persist) { persist_ = persist; }
+ size_t GetPermissionCount() const { return types_.size(); }
Peter Kasting 2016/09/21 18:44:40 Nit: Inlined accessors should be named unix_hacker
lshang 2016/09/22 02:11:31 Done.
+ ContentSettingsType GetContentSettingType(size_t index) const;
+ int GetIconIdForPermission(size_t index) const;
+
+ // ConfirmInfoBarDelegate:
base::string16 GetMessageText() const override;
Peter Kasting 2016/09/21 18:44:39 Nit: Place overrides either above or below non-ove
lshang 2016/09/22 02:11:31 Done.
- int GetPermissionCount() const;
- ContentSettingsType GetContentSettingType(int index) const;
- int GetIconIdForPermission(int index) const;
// Message text to display for an individual permission at |index|.
- base::string16 GetMessageTextFragment(int index) const;
+ base::string16 GetMessageTextFragment(size_t index) const;
- void ToggleAccept(int position, bool new_value);
+ // Toggle Allow/Block for each permission type.
+ void ToggleAccept(size_t position, bool new_value);
Peter Kasting 2016/09/21 18:44:39 Nit: Why |index| on most APIs, but |position| on t
lshang 2016/09/22 02:11:31 Done. Changed them all to |position|.
protected:
- bool GetAcceptState(int position);
+ bool GetAcceptState(size_t position);
private:
- // ConfirmInfoBarDelegate:
- base::string16 GetButtonLabel(InfoBarButton button) const override;
- int GetButtons() const override;
+ GroupedPermissionInfoBarDelegate(
+ const GURL& requesting_origin,
+ const std::vector<ContentSettingsType>& types);
- // InfoBarDelegate:
+ // ConfirmInfoBarDelegate:
+ InfoBarIdentifier GetIdentifier() const override;
Type GetInfoBarType() const override;
+ int GetButtons() const override;
+ base::string16 GetButtonLabel(InfoBarButton button) const override;
const GURL requesting_origin_;
const std::vector<ContentSettingsType> types_;
@@ -66,4 +70,8 @@ class GroupedPermissionInfoBarDelegate : public ConfirmInfoBarDelegate {
DISALLOW_COPY_AND_ASSIGN(GroupedPermissionInfoBarDelegate);
};
-#endif // CHROME_BROWSER_PERMISSIONS_GROUPED_PERMISSION_INFOBAR_DELEGATE_H_
+// Implementation is in platform-specific infobar file.
Peter Kasting 2016/09/21 18:44:39 Seems like you have an Android-specific infobar an
lshang 2016/09/22 02:11:30 Done. Also referred to other infobars, Removed thi
+std::unique_ptr<infobars::InfoBar> CreateGroupedPermissionInfoBar(
+ std::unique_ptr<GroupedPermissionInfoBarDelegate> delegate);
+
+#endif // CHROME_BROWSER_PERMISSIONS_GROUPED_PERMISSION_INFOBAR_DELEGATE_ANDROID_H_

Powered by Google App Engine
This is Rietveld 408576698