Home | History | Annotate | Download | only in people
      1 // Copyright 2013 The Chromium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 #ifndef CHROME_BROWSER_UI_APP_LIST_SEARCH_PEOPLE_PEOPLE_RESULT_H_
      6 #define CHROME_BROWSER_UI_APP_LIST_SEARCH_PEOPLE_PEOPLE_RESULT_H_
      7 
      8 #include <string>
      9 
     10 #include "base/basictypes.h"
     11 #include "base/memory/weak_ptr.h"
     12 #include "chrome/browser/ui/app_list/search/chrome_search_result.h"
     13 #include "url/gurl.h"
     14 
     15 class Profile;
     16 
     17 namespace app_list {
     18 
     19 struct Person;
     20 
     21 class PeopleResult : public ChromeSearchResult {
     22  public:
     23   PeopleResult(Profile* profile, scoped_ptr<Person> person);
     24   virtual ~PeopleResult();
     25 
     26   // ChromeSearchResult overides:
     27   virtual void Open(int event_flags) OVERRIDE;
     28   virtual void InvokeAction(int action_index, int event_flags) OVERRIDE;
     29   virtual scoped_ptr<ChromeSearchResult> Duplicate() OVERRIDE;
     30   virtual ChromeSearchResultType GetType() OVERRIDE;
     31 
     32  private:
     33   void OnIconLoaded();
     34   void SetDefaultActions();
     35   void OpenChat();
     36   void SendEmail();
     37 
     38   // Check if we have any variant of the hangouts extension installed and
     39   // waiting on the onHangoutRequested event (the hangouts extension can have
     40   // a total of four possible id's, depending on which release type of it is
     41   // installed). If so, set the hangouts_extension_id_ to the id of the
     42   // extension that is waiting, or set it to an empty string if not.
     43   void RefreshHangoutsExtensionId();
     44 
     45   Profile* profile_;
     46   scoped_ptr<Person> person_;
     47 
     48   gfx::ImageSkia image_;
     49   base::WeakPtrFactory<PeopleResult> weak_factory_;
     50 
     51   // Caches the id of the hangouts extension.
     52   std::string hangouts_extension_id_;
     53 
     54   DISALLOW_COPY_AND_ASSIGN(PeopleResult);
     55 };
     56 
     57 }  // namespace app_list
     58 
     59 #endif  // CHROME_BROWSER_UI_APP_LIST_SEARCH_PEOPLE_PEOPLE_RESULT_H_
     60