chrome/browser/extensions/api/web_navigation/web_navigation_api_helpers.cc
// Constructs and dispatches an onCommitted or onReferenceFragmentUpdated
// event.
Constructs and dispatches an onCommitted or onReferenceFragmentUpdated
event.
Constructs and dispatches an onCommitted or onReferenceFragmentUpdated event .
void DispatchOnCommitted(const char* event_name,
                         content::WebContents* web_contents,
                         int64 frame_id,
                         bool is_main_frame,
                         const GURL& url,
                         content::PageTransition transition_type) {
  scoped_ptr<ListValue> args(new ListValue());
  DictionaryValue* dict = new DictionaryValue();
  dict->SetInteger(keys::kTabIdKey, ExtensionTabUtil::GetTabId(web_contents));
  dict->SetString(keys::kUrlKey, url.spec());
  dict->SetInteger(keys::kProcessIdKey,
                   web_contents->GetRenderViewHost()->GetProcess()->GetID());
  dict->SetInteger(keys::kFrameIdKey, GetFrameId(is_main_frame, frame_id));
  const char *transition_type_as_string =
      content::PageTransitionGetCoreTransitionString(transition_type);
  DCHECK(transition_type_as_string)
      << "Navigation with invalid transition type " << transition_type;
  dict->SetString(
      keys::kTransitionTypeKey,
      transition_type_as_string ? transition_type_as_string : "unknown");
  ListValue* qualifiers = new ListValue();
  if (transition_type & content::PAGE_TRANSITION_CLIENT_REDIRECT)
    qualifiers->Append(Value::CreateStringValue("client_redirect"));
  if (transition_type & content::PAGE_TRANSITION_SERVER_REDIRECT)
    qualifiers->Append(Value::CreateStringValue("server_redirect"));
  if (transition_type & content::PAGE_TRANSITION_FORWARD_BACK)
    qualifiers->Append(Value::CreateStringValue("forward_back"));
  if (transition_type & content::PAGE_TRANSITION_FROM_ADDRESS_BAR)
    qualifiers->Append(Value::CreateStringValue("from_address_bar"));
  dict->Set(keys::kTransitionQualifiersKey, qualifiers);
  dict->SetDouble(keys::kTimeStampKey, MilliSecondsFromTime(base::Time::Now()));
  args->Append(dict);
  DispatchEvent(web_contents->GetBrowserContext(), event_name, args.Pass(),
                url);
}
void DispatchOnCommitted ( const char * event_name , content :: WebContents * web_contents , int64 frame_id , bool is_main_frame , const GURL & url , content :: PageTransition transition_type ) { scoped_ptr < ListValue > args ( new ListValue ( ) ) ; DictionaryValue * dict = new DictionaryValue ( ) ; dict -> SetInteger ( keys :: kTabIdKey , ExtensionTabUtil :: GetTabId ( web_contents ) ) ; dict -> SetString ( keys :: kUrlKey , url . spec ( ) ) ; dict -> SetInteger ( keys :: kProcessIdKey , web_contents -> GetRenderViewHost ( ) -> GetProcess ( ) -> GetID ( ) ) ; dict -> SetInteger ( keys :: kFrameIdKey , GetFrameId ( is_main_frame , frame_id ) ) ; const char * transition_type_as_string = content :: PageTransitionGetCoreTransitionString ( transition_type ) ; DCHECK ( transition_type_as_string ) << " " << transition_type ; dict -> SetString ( keys :: kTransitionTypeKey , transition_type_as_string ? transition_type_as_string : " " ) ; ListValue * qualifiers = new ListValue ( ) ; if ( transition_type & content :: PAGE_TRANSITION_CLIENT_REDIRECT ) qualifiers -> Append ( Value :: CreateStringValue ( " " ) ) ; if ( transition_type & content :: PAGE_TRANSITION_SERVER_REDIRECT ) qualifiers -> Append ( Value :: CreateStringValue ( " " ) ) ; if ( transition_type & content :: PAGE_TRANSITION_FORWARD_BACK ) qualifiers -> Append ( Value :: CreateStringValue ( " " ) ) ; if ( transition_type & content :: PAGE_TRANSITION_FROM_ADDRESS_BAR ) qualifiers -> Append ( Value :: CreateStringValue ( " " ) ) ; dict -> Set ( keys :: kTransitionQualifiersKey , qualifiers ) ; dict -> SetDouble ( keys :: kTimeStampKey , MilliSecondsFromTime ( base :: Time :: Now ( ) ) ) ; args -> Append ( dict ) ; DispatchEvent ( web_contents -> GetBrowserContext ( ) , event_name , args . Pass ( ) , url ) ; }
Constructs and dispatches an onCommitted or onReferenceFragmentUpdated
event.
Constructs and dispatches an onCommitted or onReferenceFragmentUpdated event .
// See http://crbug.com/166166. If you trigger this, please add repro steps // to the bug (or at least report what transition_type you saw).