views:

190

answers:

3

Refactored from bug_report_view.cc and bug_report_view.h, I extracted send_report(), report_phishing(), a few other smaller functions and BugReport::Cleanup into bug_report.cc and bug_report.h (my versions). Compiling now, I get:

[...]bug_report.cc:196: error: no matching function for call to ‘URLFetcher::URLFetcher(std::wstring&, URLFetcher::RequestType, BugReport::PostCleanup*)’ ../chrome/browser/net/url_fetcher.h:136:

note: candidates are: URLFetcher::URLFetcher(const URLFetcher&) ../chrome/browser/net/url_fetcher.h:82:

note: URLFetcher::URLFetcher(const GURL&, URLFetcher::RequestType, URLFetcher::Delegate*)

For some reason, BugReport::PostCleanup (in my version) isn't recognized as a subclass of URLFetcher::Delegate, but BugReportView::PostCleanup (in the first links) is. So where did I mess up? Thanks.

A: 

At:

 URLFetcher* fetcher = new URLFetcher(post_url, URLFetcher::POST,
                                       new BugReport::PostCleanup);

it can't find an URLFetcher constructor thzat takes the parameters youn give it - the problem is presumably in url_fetcher.h, which you haven't shown.

BTW, there are a lot of other problems and bad practices exhibited in your code - it would be a good idea to instigate a full code review ASAP.

anon
Mike Douglas
+3  A: 

The problem is not the type of the PostCleanup class. The problem is the type of the first parameter to the URLFetcher class constructor. The constructor expects a GURL &, you are passing a std::wstring called post_url. You will need to perform some kind of conversion between the two. Possibly something like this would be appropriate:

GURL post_url(l10n_util::GetString(IDS_BUGREPORT_POST_URL));
URLFetcher* fetcher = new URLFetcher(post_url, URLFetcher::POST,
                                   new BugReport::PostCleanup);

In the code you have modified, the class has a GURL member which is initialised in the constructor, you have changed it to a variable referenced only in that one function, but changed the type.

1800 INFORMATION
Hah, wow. The last parameter drew my attention, and I totally missed that. Thanks for your help.
Mike Douglas
A: 

First version used member variable post_url_ second just local variable post_url.
Please describe what is GURL type - it is typedef on std::wstring or something other.

bb