Commit 41dee0dd authored by tfarina@chromium.org's avatar tfarina@chromium.org

intents: Constantify some getter accessors.

R=gbillock@chromium.org
NOTRY=True

Review URL: https://chromiumcodereview.appspot.com/10834174

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@150965 0039d316-1c4b-4281-b951-d872f2087c98
parent 59c19899
......@@ -219,7 +219,7 @@ void WebIntentPickerController::ShowDialog(const string16& action,
picker_model_->Clear();
picker_model_->set_action(action);
picker_model_->set_mimetype(type);
picker_model_->set_type(type);
// If the intent is explicit, skip showing the picker.
if (intents_dispatcher_) {
......@@ -382,7 +382,7 @@ void WebIntentPickerController::OnSuggestionsLinkClicked() {
browser::FindBrowserWithWebContents(tab_contents_->web_contents());
GURL query_url = extension_urls::GetWebstoreIntentQueryURL(
UTF16ToUTF8(picker_model_->action()),
UTF16ToUTF8(picker_model_->mimetype()));
UTF16ToUTF8(picker_model_->type()));
chrome::NavigateParams params(browser, query_url,
content::PAGE_TRANSITION_AUTO_BOOKMARK);
params.disposition = NEW_FOREGROUND_TAB;
......@@ -434,7 +434,7 @@ void WebIntentPickerController::DispatchToInstalledExtension(
picker_->OnExtensionInstallSuccess(extension_id);
WebIntentsRegistry::IntentServiceList services;
GetWebIntentsRegistry(tab_contents_)->GetIntentServicesForExtensionFilter(
picker_model_->action(), picker_model_->mimetype(),
picker_model_->action(), picker_model_->type(),
extension_id,
&services);
......
......@@ -56,7 +56,7 @@ void WebIntentPickerModel::RemoveInstalledServiceAt(size_t index) {
void WebIntentPickerModel::Clear() {
DestroyAll();
action_.clear();
mimetype_.clear();
type_.clear();
inline_disposition_url_ = GURL::EmptyGURL();
if (observer_)
observer_->OnModelChanged(this);
......
......@@ -7,16 +7,13 @@
#include <vector>
#include "base/basictypes.h"
#include "base/string16.h"
#include "googleurl/src/gurl.h"
#include "ui/gfx/image/image.h"
class WebIntentPickerModelObserver;
namespace gfx {
class Image;
}
// Model for the WebIntentPicker.
class WebIntentPickerModel {
public:
......@@ -74,20 +71,17 @@ class WebIntentPickerModel {
observer_ = observer;
}
const string16& action() const { return action_; }
void set_action(const string16& action) { action_ = action; }
const string16& action() { return action_; }
void set_mimetype(const string16& mimetype) { mimetype_ = mimetype; }
const string16& mimetype() { return mimetype_; }
const string16& type() const { return type_; }
void set_type(const string16& type) { type_ = type; }
const GURL& default_service_url() const { return default_service_url_; }
void set_default_service_url(const GURL& default_url) {
default_service_url_ = default_url;
}
const GURL& default_service_url() { return default_service_url_; }
// Add a new installed service with |title|, |url| and |disposition| to the
// picker.
void AddInstalledService(const string16& title,
......@@ -145,7 +139,7 @@ class WebIntentPickerModel {
// Returns the url of the intent service that is being displayed inline, or
// GURL::EmptyGURL() if none.
GURL inline_disposition_url() const { return inline_disposition_url_; }
const GURL& inline_disposition_url() const { return inline_disposition_url_; }
private:
// Delete all elements in |installed_services_| and |suggested_extensions_|.
......@@ -160,7 +154,7 @@ class WebIntentPickerModel {
// by this model.
std::vector<SuggestedExtension*> suggested_extensions_;
// The observer to send notifications to, or NULL if none.
// The observer to send notifications to, or NULL if none. Not owned.
WebIntentPickerModelObserver* observer_;
// The url of the intent service that is being displayed inline, or
......@@ -170,8 +164,8 @@ class WebIntentPickerModel {
// A cached copy of the action that instantiated the picker.
string16 action_;
// A cached copy of the mimetype that instantiated the picker.
string16 mimetype_;
// A cached copy of the type that instantiated the picker.
string16 type_;
// The non-empty url of the default service if the WebIntentsRegistry
// finds a default service matching the intent being dispatched.
......
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